An autofocus mechanism, comprising: an objective lens that collects a laser beam to irradiate a measurement workpiece therewith; a beam splitter that splits light reflected from the measurement workpiece through the objective lens; a first light amount restricting element disposed in front of a focal position of one split beam of the reflected light; a first light-receiving element that receives the reflected beam having passed through the first light amount restricting element; a second light amount restricting element disposed behind a focal position of the other split beam of the reflected light; a second light-receiving element that receives the reflected beam having passed through the second light amount restricting element; and a processing unit that converts signals output from the first and second light-receiving elements (124, 128) into an A_signal voltage and a B_signal voltage, respectively, so as to determine an A+B_signal voltage and an S_signal voltage, which are expressed by Equations and below, A + B _ signal voltage = A _ signal voltage + B _ signal voltage S _ signal voltage = A _ signal voltage − B _ signal voltage / A _ signal voltage + B _ signal voltage characterized in that the processing unit includes: first & second voltage computing means that defines, as a first voltage and a second voltage, A+B_signal voltages at distances between the objective lens and the measurement workpiece, the first voltage and the second voltage being indicative of the maximum voltage and the minimum voltage of the S_signal voltage, respectively; S_signal validity determination voltage computing means that defines a higher one of the first voltage and the second voltage as an S_signal validity determination voltage serving as a threshold voltage which determines, as valid, an in-focus determination voltage, the in-focus determination voltage being equal to the S_signal voltage obtained when the distance is equal to a focal distance of the objective lens; and focal distance computing means that defines, as the focal distance of the objective lens, a distance at which the S_signal voltage takes on the in-focus determination voltage, the distance being given by the A+B_signal voltage equal to or greater than the S_signal validity determination voltage. an objective lens that collects a laser beam to irradiate a measurement workpiece therewith; a beam splitter that splits light reflected from the measurement workpiece through the objective lens; a first light amount restricting element disposed in front of a focal position of one split beam of the reflected light; a first light-receiving element that receives the reflected beam having passed through the first light amount restricting element; a second light amount restricting element disposed behind a focal position of the other split beam of the reflected light; a second light-receiving element that receives the reflected beam having passed through the second light amount restricting element; and a processing unit that converts signals output from the first and second light-receiving elements (124, 128) into an A_signal voltage and a B_signal voltage, respectively, so as to determine an A+B_signal voltage and an S_signal voltage, which are expressed by Equations and below, A + B _ signal voltage = A _ signal voltage + B _ signal voltage S _ signal voltage = A _ signal voltage − B _ signal voltage / A _ signal voltage + B _ signal voltage characterized in that the processing unit includes: first & second voltage computing means that defines, as a first voltage and a second voltage, A+B_signal voltages at distances between the objective lens and the measurement workpiece, the first voltage and the second voltage being indicative of the maximum voltage and the minimum voltage of the S_signal voltage, respectively; S_signal validity determination voltage computing means that defines a higher one of the first voltage and the second voltage as an S_signal validity determination voltage serving as a threshold voltage which determines, as valid, an in-focus determination voltage, the in-focus determination voltage being equal to the S_signal voltage obtained when the distance is equal to a focal distance of the objective lens; and focal distance computing means that defines, as the focal distance of the objective lens, a distance at which the S_signal voltage takes on the in-focus determination voltage, the distance being given by the A+B_signal voltage equal to or greater than the S_signal validity determination voltage. first & second voltage computing means that defines, as a first voltage and a second voltage, A+B_signal voltages at distances between the objective lens and the measurement workpiece, the first voltage and the second voltage being indicative of the maximum voltage and the minimum voltage of the S_signal voltage, respectively; S_signal validity determination voltage computing means that defines a higher one of the first voltage and the second voltage as an S_signal validity determination voltage serving as a threshold voltage which determines, as valid, an in-focus determination voltage, the in-focus determination voltage being equal to the S_signal voltage obtained when the distance is equal to a focal distance of the objective lens; and focal distance computing means that defines, as the focal distance of the objective lens, a distance at which the S_signal voltage takes on the in-focus determination voltage, the distance being given by the A+B_signal voltage equal to or greater than the S_signal validity determination voltage.