What are the conditions for 3 points to be colinear?
are you using vectors?
If yes: The three points (I name them A, B, C) are collinear, if the vectors between A and B resp. between B and C are linearly dependent.
If no: Determine the linear function going through A and B and test if C lies on that, or (easier): Determine the slope of the segment between A and B and the slope of the segment between B and C. If they are equal, the points are colinear.
Geometrically: The points are collinear if they all lie on the same line.
If you are doing purely synthetic geometry then you will have axioms about betweeness.
Three points are collinear provided one of then is between the other two.
On the other hand, if you have a distance function on the space then consider the distance between the three pairs.
If they are collinear then two of the distances will add to the third.