The associations between PRS for type 2 diabetes and all-cause dementia as well as vascular dementia were stronger in the part of the population that did not have the APOE ε4 genotype. Here, APOE is linked to type 2 diabetes mellitus.