Effects of metformin, the first-line drug for type 2 diabetes therapy, on gut microbiome composition in type 2 diabetes have been described in various studies both in human subjects and animals. However, the details of the molecular mechanisms of metformin action have not been fully understood. Moreover, there is a significant lack of information on how metformin affects gut microbiome composition in female mouse models, depending on sex and metabolic status in well controlled experimental setting. Our study aimed to examine metformin-induced alterations in gut microbiome diversity, composition, and functional implications of high-fat diet-induced type 2 diabetes mouse model, using, for the first time in mice study, the shotgun metagenomic sequencing that allows estimation of microorganisms at species level. We also employed a randomized block, factorial study design, and including 24 experimental units allocated to 8 treatment groups to systematically evaluate the effect of sex and metabolic status on metformin interaction with microbiome. We used DNA obtained from fecal samples representing gut microbiome before and after ten weeks-long metformin treatment. We identified 100 metformin-related differentially abundant species in high-fat diet-fed mice before and after the treatment, with most of the species relative abundances increased. In contrast, no significant changes were observed in control diet-fed mice. Functional analysis targeted to carbohydrate, lipid, and amino acid metabolism pathways revealed 14 significantly altered hierarchies. We also observed sex-specific differences in response to metformin treatment. Males experienced more pronounced changes in metabolic markers, while in females the extent of changes in gut microbiome representatives was more marked, indicated by 53 differentially abundant species with more remarkable Log fold changes compared to the combined-sex analysis. The same pattern manifested regarding the functional analysis, where we discovered 5 significantly affected hierarchies in female groups but not in males. Our results suggest that both sexes of animals should be included in future studies focusing on metformin effects on the gut microbiome.