As a common chronic disease, type 2 diabetes mellitus (T2DM) and its complications not only jeopardize the health of patients but also impose a heavy economic burden on society and patients' families. Nevertheless, there is a scarcity of evidence regarding the effects of nitrogen dioxide (NO2) on T2DM. In our study, daily data for T2DM outpatients, air pollutants and meteorological factors from January 1, 2018, to December 31, 2020 were collected in three cities: Dingxi, Tianshui and Longnan, an inland province of northwest China. Generalized additive model (GAM) with quasi-Poisson regression combined with the Distributed Lag Non-linear Model (DLNM) were employed to assess the associations between NO2 and daily T2DM outpatients, as well as their lag effects in various cities. We also stratified by gender, age, and season. The results from DLNM revealed that NO2 was significant positively associated with the increase of the number of outpatient visits for T2DM at individual single-day and all cumulative lag days in three cities, with the largest Relative Risk (RR) at lag05, lag05 and lag07 [RR = 1.106 (95%CI: 1.045,1.171) for Dingxi, RR = 1.095 (95%CI: 1.047,1.146) for Tianshui and RR = 1.015 (95%CI: 1.015,1.138) for Longnan]. Stratified analysis of gender, age, and season suggested that the harmful effect of NO2 was greater for males, young people (< 65 years old), and the cold season. In brief, ambient NO2 was associated with the increase in the number of outpatient visits for T2DM in three cities. Our findings suggest that the role of exposure to NO2 in T2DM pathogenesis should be further investigated in China.