Environmental toxicant exposure, including air pollution, is increasing worldwide. However, toxicant exposures are not equitably distributed. Rather, low-income and minority communities bear the greatest burden, along with higher levels of psychosocial stress. Both air pollution and maternal stress during pregnancy have been linked to neurodevelopmental disorders such as autism, but biological mechanisms and targets for therapeutic intervention remain poorly understood. We demonstrate that combined prenatal exposure to air pollution (diesel exhaust particles, DEP) and maternal stress (MS) in mice induces social behavior deficits only in male offspring, in line with the male bias in autism. These behavioral deficits are accompanied by changes in microglia and dopaminergic circuits in the brain, along with changes in the structure of the gut epithelium and microbiome. Importantly, DEP/MS-induced social deficits in males are prevented by shifting the gut microbiome by cross-fostering at birth and reversed by chemogenetic activation of the dopamine system.