There is a close relationship between adolescent mental health and physical health, so it is of great practical signiϐicance to explore the speciϐic inϐluencing factors and early warning model of students’ mental health. In this paper, the early warning model of students’ mental health risk is constructed. Firstly, the association rules and Apriori algorithm are used to explore the relationship between the important inϐluencing factors of students’ mental health and common psychological problems, and then the CMA-ES-XGBoost prediction model is proposed to address the defects of the XGBoost prediction model that has high complexity and low prediction accuracy. It adopts the hyperparameters of CMA-ES optimization algorithm to ϐind the optimal hyperparameter solution, and solves the fuzzy phenomenon existing in the early warning of mental health risks by fuzzy logic method, which reduces the error of prediction results. It is experimentally veriϐied that the mental health prediction method based on CMA-ES-XGBoost performs well on the task of students with mental health risk, and the prediction accuracy is 89.66%, which is better than the comparison model. It can accurately detect the mood ϐluctuations of students with different types of personality when they are exposed to multiple extroverted stimuli, and accurately predict the emotional risk. It shows that the model in this paper realizes the function of predicting students’ mental health status and achieves the expected goal of model design.