Importance Patients with dementia may be at an increased suicide risk. Identifying groups at greatest risk of suicide would support targeted risk reduction efforts by clinical dementia services. Objectives To examine the association between a dementia diagnosis and suicide risk in the general population and to identify high-risk subgroups. Design, Setting, and Participants This was a population-based case-control study in England conducted from January 1, 2001, through December 31, 2019. Data were obtained from multiple linked electronic records from primary care, secondary care, and the Office for National Statistics. Included participants were all patients 15 years or older and registered in the Office for National Statistics in England with a death coded as suicide or open verdict from 2001 to 2019. Up to 40 live control participants per suicide case were randomly matched on primary care practice and suicide date. Exposures Patients with codes referring to a dementia diagnosis were identified in primary care and secondary care databases. Main Outcomes and Measures Odds ratios (ORs) were estimated using conditional logistic regression and adjusted for sex and age at suicide/index date. Results From the total sample of 594 674 patients, 580 159 (97.6%) were controls (median [IQR] age at death, 81.6[72.0-88.4] years; 289 769 male patients [50.0%]), and 14 515 (2.4%) died by suicide (median [IQR] age at death, 47.4 [36.0-59.7] years; 10 850 male patients [74.8%]). Among those who died by suicide, 95 patients (1.9%) had a recorded dementia diagnosis (median [IQR] age at death, 79.5 [67.1-85.5] years; median [IQR] duration of follow-up, 2.3 [1.0-4.4] years). There was no overall significant association between a dementia diagnosis and suicide risk (adjusted OR, 1.05; 95% CI, 0.85-1.29). However, suicide risk was significantly increased in patients diagnosed with dementia before age 65 years (adjusted OR, 2.82; 95% CI, 1.84-4.33), in the first 3 months after diagnosis (adjusted OR, 2.47; 95% CI, 1.49-4.09), and in patients with dementia and psychiatric comorbidity (adjusted OR, 1.52; 95% CI, 1.21-1.93). In patients younger than 65 years and within 3 months of diagnosis, suicide risk was 6.69 times (95% CI, 1.49-30.12) higher than in patients without dementia. Conclusions and Relevance Diagnostic and management services for dementia, in both primary and secondary care settings, should target suicide risk assessment to the identified high-risk groups.