ObjectiveThe aim of this study was to investigate the effect of dapagliflozin (DAPA) on the rate of heart failure rehospitalization in patients with acute myocardial infarction (AMI) and type 2 diabetes mellitus (T2DM).MethodsAMI patients with T2DM from CZ-AMI registry between January 2017 and January 2021 were enrolled in this study. Patients were stratified into DAPA users and non-DAPA users. The primary outcome was the incidence of heart failure rehospitalization. Kaplan–Meier analysis and Cox regressions were performed to evaluate the prognostic significance of DAPA. Propensity score matching (PSM) was performed to minimize the bias of confounding factors and facilitate the comparability between groups. The enrolled patients were matched with a propensity score of 1:1.ResultsA total of 961 patients were included, and 132 (13.74%) heart failure rehospitalizations occurred during a median follow-up of 540 days. In the Kaplan–Meier analysis, DAPA users had a statistically significantly lower rate of heart failure rehospitalization than non-DAPA users (p< 0.0001). Multivariate Cox analysis showed that DAPA was an independent protective factor for heart failure rehospitalization risk after discharge (HR = 0.498, 95% CI = 0.296 ~ 0.831,p= 0.001). After 1:1 propensity score matching, survival analysis showed a lower cumulative risk of heart failure rehospitalization in DAPA users than in non-DAPA users (p= 0.0007). In-hospital and continued use of DAPA remained significantly associated with a reduced risk of heart failure rehospitalization (HR = 0.417, 95% CI = 0.417 ~ 0.838,p= 0.001). Results were consistent across sensitivity and subgroup analyses.ConclusionIn patients with diabetic AMI, in-hospital and continued use of DAPA after discharge were associated with a significant lower risk of heart failure rehospitalization.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00228-023-03495-3.