Rockburst present substantial hazards in both deep underground construction and shallow depths, underscoring the critical need for accurate prediction methods. This study addresses this need by collecting and analyzing 69 real datasets of rockburst occurring within a 500m burial depth, which poses challenges due to the dataset's multi-categorized, unbalanced, and small nature. Through a rigorous comparison and screening process involving 11 machine learning algorithms and optimization with KMeansSMOKE oversampling, the Random Forest algorithm emerged as the most optimal choice. Efficient adjustment of hyperparameters was achieved using the Optuna framework. The resulting KMSORF model, which integrates KMeansSMOKE, Optuna, and Random Forest, demonstrated superior performance compared to mainstream models such as GB, XBG, and ET. Application of the model in a tungsten mine and tunnel project showcased its ability to accurately forecast rockburst levels, thereby providing valuable insights for risk management in underground construction. Overall, this study contributes to the advancement of safety measures in underground construction by offering an effective predictive model for rockburst occurrences.