Type 2 diabetes and dementia are associated, but it is unclear whether the two diseases have common genetic risk markers that could partly explain their association. It is also unclear whether the association between the two diseases is of a causal nature. Furthermore, few studies on diabetes and dementia have validated dementia endpoints with high diagnostic precision. We tested associations between polygenic risk scores for type 2 diabetes, fasting glucose, fasting insulin and Hemoglobin A1c as exposure variables and dementia as outcome variables in 29 139 adults (mean age 55) followed for 20-23 years. Dementia diagnoses were validated by physicians through data from medical records, neuroimaging and biomarkers in cerebro-spinal fluid. The dementia endpoints included all-cause dementia, mixed dementia, Alzheimer’s disease and vascular dementia. We also tested causal associations between type 2 diabetes and dementia through 2-sample-Mendelian randomisation analyses. Seven different polygenic risk scores including single nucleotide polymorphisms with different significance thresholds for type 2 diabetes were tested. A polygenic risk score including 4 891 single nucleotide polymorphisms with a p-value of < 5e-04 showed the strongest association with different outcomes, including all-cause dementia (Hazard Ratio 1.11; Bonferroni corrected p = 3.6e-03), mixed dementia (Hazard Ratio 1.18; Bonferroni corrected p = 3.3e-04) and vascular dementia cases (Hazard Ratio 1.28; Bonferroni corrected p = 9.6e-05). The associations were stronger for non-carriers of the Alzheimer’s disease risk gene APOE ε4. There was, however, no significant association between polygenic risk scores for type 2 diabetes and Alzheimer’s disease. Furthermore, 2-sample-Mendelian randomisation analyses could not confirm a causal link between genetic risk markers of type 2 diabetes and dementia outcomes. In conclusion, polygenic risk of type 2 diabetes is associated with an increased risk of dementia, in particular vascular dementia. The findings imply that certain people with type 2 diabetes may, due to their genetic background, be more prone to develop diabetes-associated dementia. This knowledge could in the future lead to targeted preventive strategies in clinical practice.