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.