The development of an adequate credit rating model and credit risk prediction represents a difficult challenge for researchers. Considering the theoretical importance of corporate sustainability performance in the credit rating process, we aimed to develop a data mining model to predict the credit rating of companies, by incorporating ESG data to traditional accounting and financial measures with a sample of 6622 firms. For this purpose, four different classification and regression methods were utilized, i.e., regression analysis (RA), generalized linear model (GLM), CHAID tree analysis (CTA), and artificial neural networks (ANNs). The comparison of the fitting methods shows that CTA is the most appropriate method for modeling SmartRatios credit rating predictions, since it has the highest correlation coefficient (R) and the lowest relative error. Leverage (LEV) and profitability (ROA) emerged as the most important variables across all methods to predict the credit rating. The ESG pillars, environmental (E), social (S), governance (G), and ESG controversies (C) present a mixed landscape of importance values across the models. Our findings revealed that each component of ESG, environmental (E), social (S), and governance (G), contributes uniquely to predicting credit risk, which emphasizes the significant potential of integrating ESG data to the traditional financial performance indicators to enhance the accuracy and comprehensiveness of credit rating predictions.