It is an important direction for the sustainable development of pavement to mix the discarded concrete blocks with gradation according to a certain proportion after crushing, cleaning and other technological processes, partially or completely replace aggregate, and then add cement, water, and so on to make recycled concrete for pavement paving, but the traditional evaluation model for the compressive strength (CS) of recycled concrete cannot meet the requirements of efficient calculation. To address such issues, the present research proposed to apply the firefly algorithm (FA) to optimize the random forest (RF) model. The results were demonstrated by comparing the consistency of predicted and actual values, and also by analyzing the correlation coefficient (R) and root-mean-square error (RMSE). Higher R values (0.9756 and 0.9328) and lower RMSE values (3.0752 and 6.4369) for the training and test sets present the reliability of the FA and RF hybrid machine learning model. To understand the influence law of input indexes on the output index, the importance and sensitivity of variables are further analyzed. The results displayed that effective water-cement ratio (WC) and nominal maximum recycled concrete aggregate size (NMR) have the greatest impact on the output variable, with importance scores of 2.5947 and 2.4315, respectively, while the change in the recycled concrete aggregate replacement rate (RCA) has a weak influence, with an importance score of 0.4695. Introducing FA to RF for the compressive strength modeling of recycled concrete can significantly improve the computational efficiency and accuracy.