Construction equipment related accidents, such as collisions between equipment and pedestrian workers, pose a major challenge to occupational safety at construction sites. Decrement of operators' hazard detection ability resulting from attention failure is a leading cause of these accidents. Although mental fatigue induced by prolonged and monotonous operating tasks is known as the primary cause of this type of failure, little is revealed on how mental fatigue influences operators' ability to detect hazardous situations and associated visual attention features. To address this issue, this study uses wearable eye-tracking technology to evaluate the impact of mental fatigue on operators' ability in hazard detection and the corresponding patterns of visual attention allocation. Twelve healthy participants performed a simulated excavator operating task in a laboratory experiment. Subjective mental fatigue assessment, hazard detection task performance, and eye movement metrics were recorded and analyzed. In the experiment, mental fatigue was effectively induced and manipulated by a Time-On-Operating (TOO)procedure. Results revealed that operators' hazard detection ability decreased with the increase in subjective mental fatigue level, reflected by significant increases in reaction time for hazards and the number of misdetections. Attention allocation-related data were further analyzed to explain the specific manifestations of hazard detection failure in visual attention. The results indicated that the decrease of operators' hazard detection ability is associated with the changes of the distributions of fixation and gaze point while mental fatigue level increases. Consequently, clear observation of surrounding hazards and related details becomes difficult for operators. The findings demonstrate the effectiveness of wearable eye-tracking technology in measuring and quantifying operators' mental fatigue and hazard detection ability. More importantly, the findings offer insights into the impairing effect of mental fatigue on operators' hazard detection ability from a visual attention perspective. Such insights provide a solid basis for developing effective safety interventions and attentional guidance-based safety training methods to mitigate relevant site accidents.