PROBLEM TO BE SOLVED: To provide an optical surface shape detection system, a surface shape detection method, and a surface shape detection program which are capable of obtaining data which can be compared and collated with data obtained by a stylus type detector.SOLUTION: A surface of an observation object is irradiated with light, and the light is guided to a photodetector. Surface shape data representing a surface shape of the observation object is generated on the basis of an output signal of the photodetector. Further, stylus data representing a shape of a virtually set stylus ST is stored. Stylus detection data representing a locus of a reference point SS of the stylus ST during movement of the stylus in contact with the surface of the observation object is generated on the basis of the generated surface shape data and the stored stylus data.