Non-steroidal anti-inflammatory drugs (NSAIDs) should be used cautiously in patients with type 2 diabetes. We examined whether the cardiovascular risks associated with NSAID use depended on HbA1c level in patients with type 2 diabetes. We conducted a population-based cohort study of all adult Danes with a first-time HbA1c measurement ≥48 mmol/mol during 2012-2020 (n = 103 308). We used information on sex, age, comorbidity burden, and drug use to calculate time-varying inverse probability of treatment weights. After applying these weights in a pooled logistic regression, we estimated hazard ratios (HRs) of the association between use of NSAIDs (ibuprofen, naproxen, or diclofenac) and cardiovascular events (a composite of myocardial infarction, ischemic stroke, congestive heart failure, atrial fibrillation or flutter, and all-cause death). We stratified all analyses by HbA1c level (<53 or ≥53 mmol/mol). For ibuprofen use, the HR of a cardiovascular event was 1.53 (95% confidence interval [CI]: 1.34-1.75) in patients with HbA1c <53 and 1.24 (95% CI: 1.00-1.53) in patients with HbA1c ≥53 mmol/mol. For naproxen use, the HR was 1.14 (95% CI: 0.59-2.21) in patients with HbA1c <53 and 1.30 (95% CI: 0.49-3.49) in patients with HbA1c ≥53 mmol/mol. For diclofenac use, the HR was 2.40 (95% CI: 1.62-3.56) in patients with HbA1c <53 and 2.89 (95% CI: 1.65-5.04) in patients with HbA1c ≥53 mmol/mol. In patients with type 2 diabetes, glycemic dysregulation did not affect the cardiovascular risk associated with NSAID use.