The monocyte-to-lymphocyte ratio (MLR) has emerged as a novel inflammatory biomarker; however, its relationship with myocardial infarction (MI) in diabetic populations remains unclear. This study aimed to elucidate the association between MLR and MI prevalence in this unique population. This cross-sectional study used data from the National Health and Nutrition Examination Survey (NHANES), 2015-2018. MLR was utilized as both a continuous and categorical factor to examine its correlation with MI in individuals diagnosed with DM. Subgroup and sensitivity analyses were also performed. In this study, 1,295 individuals with DM were enrolled, among whom 148 (11.4%) were diagnosed with MI. Patients with MI showed a greater MLR. Using a smoothed curve-fitting analysis, a linear relationship was observed between MLR and MI (pfor non-linearity = 0.27). Multivariate logistic regression analysis showed that MLR * 10 was positively correlated with the risk of MI (OR = 1.14, 95% CI 1.01∼1.29, p = 0.041). Compared with the lowest quartile, the OR for Q2, Q3, and Q4 were 2.13 (95% CI: 1.01∼4.47), 2.95 (95% CI: 1.45∼6.00), and 2.74 (95% CI: 1.32∼5.69), respectively. Subgroup analyses showed no significant interaction for MLR in any subgroup (all P > 0.05). The receiver operating characteristic (ROC) curve indicated that the area under the curve (AUCs) of MLR for predicting MI was 0.661 (95% CI: 0.617-0.706; P < 0.05). Our study demonstrated that MLR is significantly correlated with MI in patients with DM.