The present study utilized machine learning (ML) techniques to investigate the effects of eggshell powder (ESP) and recycled glass powder (RGP) on cement composites subjected to an acidic setting. A dataset acquired from the published literature was employed to develop machine learning-based predictive models for the cement mortar’s compressive strength (CS) decrease. Artificial neural network (ANN), K-nearest neighbor (KNN), and linear regression (LR) were chosen for modeling. Also, RreliefF analysis was performed to study the relevance of variables. A total of 234 data points were utilized to train/test ML algorithms. Cement, sand, water, silica fume, superplasticizer, glass powder, eggshell powder, and 90 days of CS were considered as input variables. The outcomes of the research showed that the employed models could be applied to evaluate the reduction percentage of CS in cement composites, including ESP and RGP, after being exposed to acid. Based on the R2 values (0.87 for the ANN, 0.81 for the KNN, and 0.78 for LR), as well as the assessment of variation between test values and anticipated outcomes and errors (1.32% for ANN, 1.57% for KNN, and 1.69% for LR), it was determined that the accuracy of the ANN model was superior to the KNN and LR. The sieve diagram exhibited a correlation amongst the model predicted and target results. The outcomes of the RreliefF analysis suggested that ESP and RGP significantly influenced the CS loss of samples with RreliefF scores of 0.26 and 0.21, respectively. Based on the outcomes of the research, the ANN approach was determined suitable for predicting the CS loss of mortar subjected to acidic environments, thereby eliminating lab testing trails.