High-quality software is software that is not found defects (defects) during the inspection or testing process. The cost of repairing software defects is much more expensive than the costs during development. Prediction of software defects is proposed to determine the priority of software modules to be tested, so as to improve software quality and reduce costs. The main problems in software defect prediction are redundant data, correlation, irrelevant features and missing samples. 62 studies out of 208 studies in the development of software defect prediction models using the NASA (National Aeronautics and Space Administration) MDP Repository dataset. The handling of the imbalance class is done by using the Distribution Based Balance sampling technique and the algorithm level approach with the ensemble learning technique using Bagging. The classification algorithm used in this study is the Naïve Bayes classifier. The results showed that the proposed model achieved higher classification accuracy and AUC. In the Distribution Based Balance + Bagging + Naïve Bayes model the average accuracy value reaches 98.71%, the average AUC value is 0.987 with an average AUC percentage increase of 0.373. While in the comparison model, namely SMOTE+Bagging+Naïve Bayes the average accuracy value reaches 73.30%, the average AUC value is 0.639 with an average AUC percentage increase of 0.025. From these results, it can be concluded that the proposed model is Distribution Based Balance+Bagging+Nave Bayes is the best model to handle imbalance class.