It has been hypothesized that prenatal exposure to testosterone may be associated with traits of attention-deficit/hyperactivity disorder (ADHD) or autism spectrum disorder (ASD). We conducted a population-based study of dizygotic female twins to elucidate this hypothesis, assuming that the sex of the co-twin influences the level of prenatal exposure to testosterone. We invited parents of 24,552 3- to 15-year-old twins to answer questionnaires on traits of ADHD and ASD. We analysed the data using a proportional odds model with sex of the co-twin as an instrumental variable for prenatal exposure to testosterone of female twins. We received responses for 6,339 girls from dizygotic twin pairs. Odds ratios for male versus female co-twin were 0.71 (95 % confidence interval 0.61-0.81) for ADHD traits and 0.74 (0.66-0.83) for ASD traits, indicating that a twin brother reduces traits of ADHD and ASD in females. In conclusion, we found that female twins with a twin brother scored significantly lower in parent-reported traits of ADHD and ASD than those with a twin sister. The reason for this may be parental reporting bias, or confounding by unmeasured variables, or a causal effect of an intrauterine environment modified by the sex of the co-twin in the opposite direction of what we expected.