Sex is one of the important factors affecting gut microbiota. As key predators in agro-forestry ecosystem, many spider species show dramatically different activity habits and nutritional requirements between female and male. However, how sex affects gut microbiota of spiders is still unclear. Therefore, in this study, the compositions and diversities of gut bacteria, based on bacterial 16S rRNA gene sequencing, were compared between female and male Pardosa astrigera. We found that bacterial richness indices (P < 0.05) in female were significantly lower than male, meanwhile, β-diversity showed significantly different between female and male (P < 0.05). The relative abundance of Actinobacteriota and Rhodococcus (belongs to Actinobacteria) were significantly higher in female than male (P < 0.05). Whereas, the relative abundance of Firmicutes and Acinetobacter (belongs to Proteobacteria), Ruminococcus and Fusicatenibacter (all belong to Firmicutes), were significantly higher in male than female (P < 0.05). The results of PICRUSt2 showed that amino acid and lipid metabolisms were significantly higher in female than male (P < 0.05), whereas glycan biosynthesis and metabolism was significantly higher in male than female (P < 0.05). Our results imply that sexual variation is a crucial factor in shaping gut bacterial community in P. astrigera. Male P. astrigera dispersed more widely than the female hence the male had a higher bacterial diversity. While the distinct differences of bacterial composition mainly due to their different nutritional and energy requirements.