SUMMARYGestational exposure to environmental toxins and socioeconomic stressors is epidemiologically linked to neurodevelopmental disorders with strong male bias, such as autism. We model these prenatal risk factors in mice by co-exposing pregnant dams to an environmental pollutant and limited-resource stress, which robustly activates the maternal immune system. Only male offspring display long-lasting behavioral abnormalities and alterations in the activity of brain networks encoding social interactions. Cellularly, prenatal stressors diminish microglial function within the anterior cingulate cortex, a central node of the social coding network, in males during early postnatal development. Precise inhibition of microglial phagocytosis within the anterior cingulate cortex (ACC) of wild-type (WT) mice during the same critical period mimics the impact of prenatal stressors on a male-specific behavior, indicating that environmental stressors alter neural circuit formation in males via impairing microglia function during development.