The invention provides an optical detector with a precise positioning function, and relates to the field of optical detection. The optical detector with the precise positioning function comprises a base, a shell is fixedly installed at the top of the base, a movable sliding groove is formed in the position, located on the outer side of the shell, of the top of the base, and a shading plate is rotationally installed in the movable sliding groove through a bearing. According to the optical detector with the precise positioning function, magnifying lenses with different sizes can be clamped and fixed, so that a clamp does not need to be replaced when the magnifying lenses with different sizes are clamped, and the optical detector is convenient and rapid to use, the center positions of the magnifying lenses can be kept at the same position when the magnifying lenses with different diameters and thicknesses are clamped, so that the clamping and positioning accuracy is improved, and finally, the imaging is performed through irradiation, and the imaged image is shot and stored through the acquisition camera, whether the magnifying lens is qualified or not can be determined through distribution of imaging light spots.