Major depressive disorder (MDD) is a persistent psychiatric mood disorder that is prevalent from a few weeks to a few months, even for years in the worst cases. It causes sadness, hopelessness in the individuals; sometimes, it forces them to hurt themselves. In severe cases, MDD can even lead to the death of the individual. It is challenging to diagnose MDD as it co-occurs with many other disorders (Co-Morbid) and many other reasons such as mobility, lack of motivation, and cost. The way to diagnose MDD is usually high ended that is challenging for the regular clinicians to diagnose. Therefore, to make their work more comfortable, and to predict MDD at the early stages, we have developed an ensemble-based machine learning model. The data collected has been cleaned with a preprocessing technique, and feature selection are performed using wrapper based methods; moreover, in the final step, a stacking based ensemble learning model is implemented to classify the MDD patients. Furthermore, KNN Imputation is implemented for preprocessing, Random Forest-Based Backward Elimination for feature selection and multi-layer perceptron, SVM and Random Forest as low-level learners in stacking generalization model. The results show that the prediction accuracy of the stacking generalization model is superior to the individual classifiers. INDEX TERMS K-nearest neighbors, major depressive disorder, multilayer perceptron, random forest, random forest-based feature elimination, stacking generalization and support vector machine.