College and university physical education programs play a crucial role in enhancing students’ fitness and mental health, serving as a vital means of fostering their mental well-being. This paper outlines the structural design of college physical education courses and suggests effective strategies to enhance students’ mental health through their construction. This paper utilizes the mental health level as an index to gauge the impact of college physical education curriculum construction on students’ mental health. It develops a method for evaluating the mental health of college students using a Krill swarm algorithm-optimized support vector machine. It uses the evaluation indexes of somatization and depression from the SCL-90 as inputs for the KH-SVM evaluation model, which then outputs the students’ mental health status. We selected 660 students enrolled in 2022 at W College as research subjects for the mental health assessment. With the exception of the terror factor (P=0.145>0.145), the P values for other mental health level factors like somatization and obsessive-compulsive disorder before and after the optimization and construction of college physical education courses are less than 0.05, indicating significant differences and improvements in the psychological problems associated with these factors. After the optimization and construction of physical education courses, the total mean score of SCL-90 students was 146.73, which was 28.78 points lower than the score of 175.48 before the experiment, which was at a healthy level.