Measuring the uniaxial compressive strength (UCS) of rocks in a laboratory setting is a time-consuming and expensive process. To address this challenge, developing an accurate model based on easily obtainable rock properties is a practical approach. In this study, 112 datasets comprising non-destructive parameters, including P-wave velocity, porosity, Leeb hardness, and density, were selected as input variables. The hyperparameters of used machine learning (ML) algorithms including eXtreme gradient boosting (XGBoost) and random forest (RF) were optimized using meta-heuristic algorithms, like whale optimization algorithm (WOA), genetic algorithm (GA), and Bayesian optimization (BO). The best model was determined using performance indices like the determination coefficient (R2), the variance accounted for (VAF), the normalized root mean square error (NRMSE), and the mean absolute error (MAE). Therefore, six hybrid models, namely WOA-XGBoost, BO-XGBoost, GA-XGBoost, WOA-RF, BO-RF, and GA-RF, were developed. The findings demonstrated that the BO-RF model outperformed the other hybrid models. The values of R2, NRMSE, VAF, and MAE for the BO-RF model were equal to 0.901, 0.192, 90.1, and 14.36, respectively. This study introduces an approach by combining meta-heuristic optimization algorithms with ML techniques to predict UCS using non-destructive tests, offering a significant advancement over traditional regression and standalone ML methods.