The accurate estimation of rock strength is an essential task in almost all rock-based projects, such as tunnelling and excavation. Numerous efforts to create indirect techniques for calculating unconfined compressive strength (UCS) have been attempted. This is often due to the complexity of collecting and completing the abovementioned lab tests. This study applied two advanced machine learning techniques, including the extreme gradient boosting trees and random forest, for predicting the UCS based on non-destructive tests and petrographic studies. Before applying these models, a feature selection was conducted using a Pearson’s Chi-Square test. This technique selected the following inputs for the development of the gradient boosting tree (XGBT) and random forest (RF) models: dry density and ultrasonic velocity as non-destructive tests, and mica, quartz, and plagioclase as petrographic results. In addition to XGBT and RF models, some empirical equations and two single decision trees (DTs) were developed to predict UCS values. The results of this study showed that the XGBT model outperforms the RF for UCS prediction in terms of both system accuracy and error. The linear correlation of XGBT was 0.994, and its mean absolute error was 0.113. In addition, the XGBT model outperformed single DTs and empirical equations. The XGBT and RF models also outperformed KNN (R = 0.708), ANN (R = 0.625), and SVM (R = 0.816) models. The findings of this study imply that the XGBT and RF can be employed efficiently for predicting the UCS values.