There is a well-established link between allergies and mental health. While both atopic and food allergies are associated with increased levels of depression and anxiety, it is unclear what the mechanism behind this relationship is. Several theories touch upon potential psychological mechanisms, but until now only general reductions in cognitive performance as a function of allergy have been reported. We employed a tablet-based high-resolution assessment of cognition that also recorded mental health, socio-economic status, and allergies in 533 children aged 7-9 years. We then employed mediation analyses to investigate the role of cognitive variables in the relation between allergy and mental health, Welch's t-tests to test for differences between children with and without allergies, and logistic regression to identify what variables predicted allergic state. In line with previous research, we found children with allergies reported higher levels of anxiety and depression. Furthermore, they showed a unique profile of higher processing speed, equal verbal short-term memory, and worse performance on tests of fluid reasoning, number sense, search organisation, and spatial short-term memory. We confirmed that these variables predicted allergic state using logistic regression. Finally, mediation analyses showed that cognition partially mediated the relationship between allergy and both anxiety and depression. Our results suggest that allergies bias children towards particular cognitive profiles, which in turn are risk factors for anxiety and depression. This supports the view that early intervention could reduce the number of allergic children that develops comorbid psychiatric conditions.