Previous studies suggested that risk for Autism Spectrum Disorder (ASD) may be increased in children exposed to antidepressants during the prenatal period. The disease specificity of this risk has not been addressed and the possibility of confounding has not been excluded. Children with ASD or attention-deficit hyperactivity disorder (ADHD) delivered in a large New England health-care system were identified from electronic health records (EHR), and each diagnostic group was matched 1:3 with children without ASD or ADHD. All children were linked with maternal health data using birth certificates and EHRs to determine prenatal medication exposures. Multiple logistic regression was used to examine association between prenatal antidepressant exposures and ASD or ADHD risk. A total of 1377 children diagnosed with ASD and 2243 with ADHD were matched with healthy controls. In models adjusted for sociodemographic features, antidepressant exposure prior to and during pregnancy was associated with ASD risk, but risk associated with exposure during pregnancy was no longer significant after controlling for maternal major depression (odds ratio (OR) 1.10 (0.70-1.70)). Conversely, antidepressant exposure during but not prior to pregnancy was associated with ADHD risk, even after adjustment for maternal depression (OR 1.81 (1.22-2.70)). These results suggest that the risk of autism observed with prenatal antidepressant exposure is likely confounded by severity of maternal illness, but further indicate that such exposure may still be associated with ADHD risk. This risk, modest in absolute terms, may still be a result of residual confounding and must be balanced against the substantial consequences of untreated maternal depression.