Background: Longtime standing may cause fatigue and discomfort in the lower extremities, leading to an increased risk of falls and related musculoskeletal diseases. Therefore, preventive interventions and fatigue detection are crucial. This study aims to explore whether anti-fatigue mats can improve gait parameters following long periods of standing and try to use machine learning algorithms to identify the fatigue states of standing workers objectively. Methods: Eighteen healthy young subjects were recruited to stand on anti-fatigue mats and hard ground to work 4 h, including 10 min rest. The portable gait analyzer collected walking speed, stride length, gait frequency, single support time/double support time, swing work, and leg fall intensity. A Paired sample t-test was used to compare the difference of gait parameters without standing intervention and standing on two different hardness planes for 4 h. An independent sample t-test was used to analyze the difference between males and females. The K-nearest neighbor (KNN) classification algorithm was performed, the subject’s gait characteristics were divided into non-fatigued and fatigue groups. The gait parameters selection and the error rate of fatigue detection were analyzed. Results: When gender differences were not considered, the intensity of leg falling after standing on the hard ground for 4 h was significantly lower than prior to the intervention (p < 0.05). When considering the gender, the stride length and leg falling strength of female subjects standing on the ground for 4 h were significantly lower than those before the intervention (p < 0.05), and the leg falling strength after standing on the mat for 4 h was significantly lower than that recorded before the standing intervention (p < 0.05). The leg falling strength of male subjects standing on the ground for 4 h was significantly lower than before the intervention (p < 0.05). After standing on the ground for 4 h, female subjects’ walking speed and stride length were significantly lower than those of male subjects (p < 0.05). In addition, the accuracy of testing gait parameters to predict fatigue was medium (75%). After standing on the mat was divided into fatigue, the correct rate was 38.9%, and when it was divided into the non-intervention state, the correct rate was 44.4%. Conclusion: The results show that the discomfort and fatigue caused by standing for 4 h could lead to the gait parameters variation, especially in females. The use of anti-fatigue mats may improve the negative influence caused by standing for a long period. The results of the KNN classification algorithm showed that gait parameters could be identified after fatigue, and the use of an anti-fatigue mat could improve the negative effect of standing for a long time. The accuracy of the prediction results in this study was moderate. For future studies, researchers need to optimize the algorithm and include more factors to improve the prediction accuracy.