Every academic institution's goal is to identify students who require additional assistance and take appropriate actions to improve their performance. As such, various research studies have focused on developing prediction models that can detect correlated patterns influencing students' performance, dropout, collaboration, and engagement. Among the influential predictive models available, the bagging ensemble has captured the interest of researchers seeking to improve prediction accuracy over single classifiers. However, prior work in this area has focused mainly on selecting single classifiers as the base classifier of the bagging ensemble, with little to no further optimization of the proposed framework. This study aims to fill this gap by providing a bagging ensemble framework to optimize its hyperparameters and achieve improved prediction accuracy. The proposed model used the Weka BESTrees data mining tool and Math language course student dataset from UCI Machine Learning Repository. Based on the experiments performed, the proposed bagging optimization technique can effectively increase the accuracy of a traditional bagging ensemble method. It reveals further that the proposed BESTrees framework can achieve an optimized performance when trained with the appropriate hyperparameters and hill climb metrics.