Random forest is a powerful ensemble learning technique celebrated for its heightened predictive performance and robustness in handling complex datasets; nevertheless, it is criticized for its computational expense, particularly with a large number of trees in the ensemble. Moreover, the model’s interpretability diminishes as the ensemble’s complexity increases, presenting challenges in understanding the decision-making process. Although various pruning techniques have been proposed by researchers to tackle these issues, achieving a consensus on the optimal strategy across diverse datasets remains elusive. In response to these challenges, this paper introduces an innovative machine learning algorithm that integrates random forest with Naïve Bayes to predict student performance. The proposed method employs the Naïve Bayes formula to evaluate random forest branches, classifying data by prioritizing branches based on importance and assigning each example to a single branch for classification. The algorithm is utilized on two sets of student data and is evaluated against seven alternative machine-learning algorithms. The results confirm its strong performance, characterized by a minimal number of branches.