BACKGROUND: Acute kidney injury (AKI) is a frequent and severe complication in critically ill patients with acute myocardial infarction (AMI), significantly worsening prognosis. Identifying early risk markers for AKI in AMI patients is critical for timely intervention. The stress hyperglycemia ratio (SHR), a marker of acute glycemic response to physiological stress, has been proposed as a predictor of AKI, but its role remains unclear. OBJECTIVE: This study investigates the association between SHR and AKI development in critically ill patients with AMI, using data from the MIMIC-III and MIMIC-IV databases. METHODS: A total of 4,663 critically ill AMI patients were analyzed. SHR was evaluated for its association with AKI incidence using logistic regression, restricted cubic splines, and mediation analysis. Subgroup and sensitivity analyses were performed to confirm robustness. Additionally, Cox regression and Kaplan-Meier survival analysis were used to explore SHR's association with in-hospital mortality in the overall cohort and AKI subgroup. RESULTS: Higher SHR levels were independently associated with an increased risk of AKI, demonstrating a J-shaped relationship. Mediation analysis revealed that neutrophil count and albumin partially mediated this effect. Kaplan-Meier survival curves showed significant differences in in-hospital mortality among SHR quartiles (log-rank CONCLUSIONS: SHR serves as an early and independent marker for AKI risk in critically ill AMI patients, offering potential utility in clinical risk stratification. However, its role in predicting in-hospital mortality appears limited. These findings underscore the importance of glycemic monitoring and management in AMI patients at risk of AKI.