Objective: Diabetes mellitus has been suspected to increase mortality in acute pyelonephritis (APN) patients and the goal of this study is to verify this suspicion with a large data set based on almost the entire population of South Korea. Methods: A nationwide cohort study was conducted using a South Korean Health Insurance Review and Assessment Service claim database. We collected demographic and clinical information including comorbidities of patients with APN as the primary discharge diagnosis during 2010–2014. Then we compared the in-hospital mortality and recurrence of APN across the diabetes and non-diabetes groups. Results: Among 845,656 APN patients, 12.4% had diabetes mellitus. The median age was 65 in the diabetes group, which was much higher than 47 in the non-diabetes group; the female proportion was 91–92% in both groups. The in-hospital mortality rate was higher in the diabetes group (2.6/1000 events in the diabetes group vs. 0.3/1000 in the non-diabetes group, P < 0.001). When covariates (age, sex, and the modified Charlson comorbidity index) were controlled with panel logistic regression, diabetes was still associated with a higher in-hospital mortality in APN patients (OR 2.66, 95% CI 2.19–3.23). The increasing effect of diabetes on in-hospital mortality of APN patients varied greatly with age: the effect was large for age 15–49 (OR 15.06, 95% CI 5.27–43.05), slightly smaller for age 50–64 (OR 12.17, 95% CI 5.71–25.92), and much smaller for age ≥ 65 (OR 2.10, 95% CI 1.72–1.92). Conclusions: Our data indicate that the mortality of APN is higher in the patients with diabetes and this effect becomes stronger for young patients.