Predicting the dynamic mechanical characteristics of rocks during freeze–thaw cycles (FTC) is crucial for comprehending the damage process of FTC and averting disasters in rock engineering in cold climates. Nevertheless, the conventional mathematical regression approach has constraints in accurately forecasting the dynamic compressive strength (DCS) of rocks under these circumstances. Hence, this study presents an optimized approach by merging the Coati Optimization Algorithm (COA) with Random Forest (RF) to offer a reliable solution for nondestructive prediction of DCS of rocks in cold locations. Initially, a database of the DCS of rocks after a series of FTC was constructed, and these data were obtained by performing the Split Hopkinson Pressure Bar Test on rocks after FTC. The main influencing factors of the test can be summarized into 10, and PCA was employed to decrease the number of dimensions in the dataset, and the microtests were used to explain the mechanism of the main influencing factors. Additionally, the Backpropagation Neural Network and RF are used to construct the prediction model of DCS of rock, and six optimization techniques were employed for optimizing the hyperparameters of the model. Ultimately, the 12 hybrid prediction models underwent a thorough and unbiased evaluation utilizing a range of evaluation indicators. The outcomes of the research concluded that the COA-RF model is most recommended for application in engineering practice, and it achieved the highest score of 10 in the combined score of the training and testing phases, with the lowest RMSE (4.570,8.769), the lowest MAE (3.155,5.653), the lowest MAPE (0.028,0.050), the highest R2 (0.983,0.94).