Since corrosion causes considerable losses in many fields, including the economy, environment, society, industry, security, and safety, it is a major concern for the industrial and academic sectors. Damage control of materials based on organic compounds is currently a field of great interest. Because it is non-toxic, affordable, and effective in a variety of corrosive situations, pyrimidine has potential as a corrosion inhibitor. It takes a lot of time and resources to carry out experimental investigations in the exploration of potential corrosion inhibitor candidates. In this study, we evaluate the gradient boosting regressor (GBR), support vector regression (SVR), and k-nearest neighbor (KNN) algorithms as predictive models for corrosion inhibition efficiency using a machine learning (ML) approach based on the quantitative structure-property relationship model (QSPR). Based on the metric coefficient of determination (R2) and root mean square error (RMSE), we found that the GBR model had the best predictive performance compared to the SVR and KNN models as well as models from the literature for pyrimidine compound datasets. Overall, our study offers a new perspective on the ability of ML models to predict corrosion inhibition of iron surfaces