Aims: Using the UK Biobank cohort, a large sample of middle aged and older adults in the UK, the present study aimed to examine the cross-sectional association between type 2 diabetes and cognition and to assess the hypothesised mediating role of common comorbid conditions, whilst controlling for important demographic and lifestyle factors. Methods: Using regression models and general structural equation models, we examined the cross-sectional association between type 2 diabetes status and: fluid intelligence; reaction time; visual memory; digit span and prospective memory; and the hypothesised mediating role of common comorbid conditions: visceral obesity; sleep problems; macrovascular problems; respiratory problems; cancer and depressive symptoms in 47,468 participants from the UK Biobank cohort, of whom 1,831 have type 2 diabetes. We controlled for ethnicity, sex, age, deprivation, smoking status, alcohol consumption, physical activity levels and use of diabetes medication. Results: Participants with type 2 diabetes had a significantly shorter digit span, b = -0.14, CIs [-0.27, -0.11] than those without type 2 diabetes. Those with type 2 diabetes did not differ from those without type 2 diabetes on fluid intelligence, reaction time, visual memory and prospective memory. The associations that do exist between type 2 diabetes and cognition are consistently mediated via macrovascular problems, depressive symptoms, and to a lesser extent visceral obesity. Respiratory problems, sleep disturbances and cancer did not mediate the association between type 2 diabetes status and measures of cognition. Conclusions: Comorbid conditions explain some of the observed association between type 2 diabetes and cognitive deficits. This suggests that prevention, management or treatment of these comorbid conditions may be important to reduce the likelihood of cognitive decline. Treatment studies with long follow-ups are needed to examine this.