The presence of metabolic dysfunction-associated steatotic liver disease (MASLD) in patients with diabetes mellitus (DM) is associated with a high risk of cardiovascular disease, but is often underdiagnosed. To develop machine learning (ML) models for risk assessment of MASLD occurrence in patients with DM. Feature selection determined the discriminative parameters, utilized to classify DM patients as those with and without MASLD. The performance of the multiple logistic regression model was quantified by sensitivity, specificity, and percentage of correctly classified patients, and receiver operating characteristic (ROC) curve analysis. Decision curve analysis (DCA) assessed the model's net benefit for alternative treatments. We studied 2000 patients with DM (mean age 58.85 ± 17.37 years; 48% women). Eight parameters: age, body mass index, type of DM, alanine aminotransferase, aspartate aminotransferase, platelet count, hyperuricaemia, and treatment with metformin were identified as discriminative. The experiments for 1735 patients show that 744/991 (75.08%) and 586/744 (78.76%) patients with/without MASLD were correctly identified (sensitivity/specificity: 0.75/0.79). The area under ROC (AUC) was 0.84 (95% CI, 0.82-0.86), while DCA showed a higher clinical utility of the model, ranging from 30% to 84% threshold probability. Results for 265 test patients confirm the model's generalizability (sensitivity/specificity: 0.80/0.74; AUC: 0.81 [95% CI, 0.76-0.87]), whereas unsupervised clustering identified high-risk patients. A ML approach demonstrated high performance in identifying MASLD in patients with DM. This approach may facilitate better risk stratification and cardiovascular risk prevention strategies for high-risk patients with DM at risk of MASLD.