Abstract Psychological health education is the main battlefield for promoting the mental health of college students. This article studies the impact of ideological and political education in universities on the mental health of college students. Research on Student Mental Health Based on DL. A student emotion recognition model based on DL (deep learning) has been established. The separable CNN (Convolutional neural network) is used to detect the face in the image, and the face is located and tracked through the tracker. After normalizing the facial image, it is input into a deep separable CNN for classification. The results indicate that the regression equation can explain 74.106% of the total variation. The political characteristics of Demographics characteristics have a significant impact on college students’ political entity identity, while gender, grade, and major have no significant impact on college students’ Party identification. Social practice and campus culture have a significant positive impact on the political entity identity of college students. Compared with traditional machine learning-based emotion recognition methods, the classification accuracy of the proposed method in this paper has been improved by 8.036%, and research based on DL technology has significant advantages in accuracy.