Around the world, 5% of adults suffer from depression, which is often inadequately treated. Depression is caused by a complex relationship of cultural, psychological, and physical factors. This growing issue has become a significant public health problem globally. Medical datasets often contain redundant characteristics, missing information, and high dimensionality. By using an iterative floating elimination feature selection algorithm and considering various factors, we can reduce the feature set and achieve optimized outcomes. The research utilizes the 36-Item Short Form Survey (SF-36) from the NHANES 2015–16 dataset, which categorizes data into seven groups relevant to quality of life and depression. This dataset presents a challenge due to its imbalance, with only 8.08% of individuals diagnosed with depression. The Depression Ensemble Stacking Generalization Model (DESGM) employs stratified k-fold cross-validation and oversampling for training data. DESGM enhances the classification performance of both base learners (linear support vector machine, perceptron, artificial neural network, linear discriminant analysis, and K-nearest neighbor) and meta-learners (logistic regression). The model achieved an F1 score of 0.9904 and an accuracy of 98.17%, with no instances of depression misdiagnosed.