Children and young people with Autism Spectrum Disorder (ASD) have an increased risk of comorbidities, such as epilepsy and Attention-Deficit/Hyperactivity Disorder (ADHD). However, little is known about the relationship between early childhood epilepsy (below age 7) and later ADHD diagnosis (at age 7 or above) in ASD. In this historical cohort study, we examined this relationship using an innovative data source, which included linked data from routinely collected acute hospital paediatric records and childhood community and inpatient psychiatric records. In a large sample of children and young people with ASD (N = 3237), we conducted a longitudinal analysis to examine early childhood epilepsy as a risk factor for ADHD diagnosis while adjusting for potential confounders, including socio-demographic characteristics, intellectual disability, family history of epilepsy and associated physical conditions. We found that ASD children and young people diagnosed with early childhood epilepsy had nearly a twofold increase in risk of developing ADHD later in life, an association which persisted after adjusting for potential confounders (adjusted OR = 1.72, CI95% = 1.13–2.62). This study suggests that sensitive monitoring of ADHD symptoms in children with ASD who have a history of childhood epilepsy may be important to promote early detection and treatment. It also highlights how linked electronic health records can be used to examine potential risk factors over time for multimorbidity in neurodevelopmental conditions.