BACKGROUND: Autism spectrum disorder (ASD) is a group of neurodevelopmental disorders with unknown etiology and unclear pathogenesis. Although construction of animal models of ASD using chemical exposure during pregnancy is a mature technique, the gut microbiota of these exposure models induced using different chemicals in mice have not been compared. METHODS: To compare the effects of exposure to different chemicals during pregnancy on the composition of gut microbiota in offspring, we treated Institute of Cancer Research (ICR) mice with lipopolysaccharide (LPS) and valproic acid (VPA) during pregnancy to construct different offspring ASD mouse models. After successful model construction, the gut microbiota of these models were studied. RESULTS: After adjusting for the random effects of the litter, the two groups showed a significant reduction in social time (social deficits) and an increase in self-grooming behaviors (repetitive and stereotyped behaviors). Gut microbiota analysis revealed significant changes, mostly a decrease, in the abundance of four phyla, 52 genera, and 41 species in the two types of ASD models. Several different gut microbes could be related to the development of ASD. CONCLUSIONS: Chemicals exposure during pregnancy induces ASD-related behavioral abnormalities in offspring mice. Importantly, exposure to different chemicals during pregnancy produces varying degrees of effects on gut microbiota composition in offspring ASD models. This finding can provide a reference for studies on the etiology and pathogenesis of ASD.