In order to further promote the application of cementitious sand gravel (CSG), the mechanical properties and variation rules of CSG material under triaxial test were studied. Considering the influence of fly ash content, water-binder ratio, sand rate and lateral confining pressure, 81 cylinder specimens were designed and made for conventional triaxial test, and the influence laws of stress–strain curve, failure pattern, elastic modulus, energy dissipation and damage evolution of specimens were analyzed. The results showed that the peak of stress–strain curve increased with the increase of confining pressure, and the peak stress, peak strain and energy dissipation all increased significantly, but the damage variable D decreased with the increase of confining pressure. Under triaxial compression, the specimen was basically sheared failure from the bonding surface, and the aggregate generally did not break. Sand rate had a significant effect on the peak stress of CSG, and decreased with the increase of sand rate. Under the conditions of the same cement content, fly ash content and confining pressure, the optimal water-binder ratio 1.2 existed when the sand rate was 0.2 and 0.3. After analyzing and processing the stress–strain curve of triaxial test, a Cuckoo Search-eXtreme Gradient Boosting (CS-XGBoost) curve prediction model was established, and the model was evaluated by evaluation indexes R2, RMSE and MAE. The average R2 of the XGBoost model based on initial parameters under 18 different output features was 0.8573, and the average R2 of the CS-XGBoost model was 0.9516, an increase of 10.10%. Moreover, the prediction curve was highly consistent with the test curve, indicating that the CS algorithm had significant advantages. The CS-XGBoost model could accurately predict the triaxial stress–strain curve of CSG.