Attention-deficit hyperactivity disorder (ADHD) is a neurodevelopmental disorder typically detected in childhood. Although ADHD has been demonstrated to have a strong genetic component, environmental risk factors, such as maternal infections during pregnancy, may also play a role. We therefore measured the immunological response to 5 abundant microorganisms (Toxoplasmosis Gondii, cytomegalovirus (CMV), Herpes Simplex Virus 1, Epstein Barr Virus and mycoplasma pneumoniae) in newborn heel prick samples of 1679 ADHD cases and 2948 matching controls as part of the iPSYCH Danish case-cohort study. We found an association between high anti-CMV (OR 1.30, 95 % CI [1.09,1.55], p = 0.015) and anti-mycoplasma (OR 1.30, 95 % CI [1.07,1.59], p = 0.037) signal and those newborns later being diagnosed with ADHD. The risk estimate remained increased when controlling for ADHD polygenic risk score as well as penicillin prescriptions. We saw a dose–response association with the amount of positive anti-microorganism titers increasing the risk of being diagnosed with ADHD later in life (p = 0.01 for the trend), suggesting that the more activated the immune system is prior to or at birth, the higher the risk is for a later diagnosis with ADHD. If the associations are causal, they emphasize the importance of a healthy life style during pregnancy to reduce the risk of infections when pregnant and the associated risks for the child.