Mental health is an important public issue linked to socio-political determinants, including unemployment, income and education. In this research, we built machine learning model to predict the mental illness based on an Internet survey dataset which consists of 334 US respondents and containing 31 demographic, socioeconomic, clinical features. Several resampling techniques such as Random Over-Sampling, Random Under-Sampling, SMOTE and ADASYN were tested to deal with the imbalance of class in the dataset. Various classifiers e.g. Random Forest, Gaussian Naive Bayes, Support Vector Classifier, XGBoost, Logistic Regression and a Stacking ensemble were trained and tested. The experiments demonstrated that the resampling considerably improved the classifier performance and ADASYN in combination with Stacking ensembles had an almost perfect predictive accuracy (99.9 %) under 5-fold cross validation. Moreover, explainable AI techniques based on SHAP values were used to interpret feature contributions uncovering depression, anxiety, fatigue and hospitalization history as major contributors. These results indicate that advanced ensemble learning with adaptive resampling can be a useful approach to predicting mental health and provide interpretable knowledge relevant for clinicians and decision makers in the early stages of detection and intervention.