Depression is a widespread mental health condition characterized by enduring feelings of persistent sadness, loss of interest, and impaired daily functioning. Untreated depression can result in significant implications, such as academic failure, social isolation, and even suicide. This study presents a machine learning (ML)–based framework for classifying depression severity among university students using the Zahir depression scale dataset, comprising 478 responses categorized into mild, moderate, severe, and profound depression. In order to address the issue of class imbalance, we utilized the synthetic minority over sampling technique (SMOTE) on the dataset. In addition, seven different ML algorithms are employed to classify the severity of depression, and each algorithm’s efficiency is determined by four performance evaluation metrics. Among the applied ML classifiers, extra tree classifier outperformed with an average accuracy of 97.85% and 95.75% precision, 95.76% recall, and 95.75% F1-score. To enhance interpretability, the shapley additive explanations (SHAP) method was integrated to identify influential features, providing transparency and insight into the model’s decision process. The proposed framework demonstrates that combining explainable artificial intelligence (XAI) with traditional ML can support healthcare professionals in early depression screening and data driven mental health interventions.