In recent years, methylene blue (MB) has attracted considerable interest as a potential drug for the treatment of methemoglobinemia and neurodegenerative diseases. MB is active against microorganisms from various taxonomic groups. However, no studies have yet been conducted on the effect of MB on the intestinal microbiome of model animals. The aim of this work was to study the effect of different concentrations of MB on the mouse gut microbiome and its relationship with the cognitive abilities of mice. We showed that a low MB concentration (15 mg/kg/day) did not cause significant changes in the microbiome composition. The Bacteroidetes/Firmicutes ratio decreased relative to the control on the 2nd and 3rd weeks. A slight decrease in the levels Actinobacteria was detected on the 3rd week of the experiment. Changes in the content of Delta, Gamma, and Epsilonproteobacteria have been also observed. We did not find significant alterations in the composition of intestinal microbiome, which could be an indication of the development of dysbiosis or other gut dysfunction. At the same time, a high concentration of MB (50 mg/kg/day) led to pronounced changes, primarily an increase in the levels of Delta, Gamma and Epsilonproteobacteria. Over 4 weeks of therapy, the treatment with high MB concentration has led to an increase in the median content of Proteobacteria to 7.49% vs. 1.61% in the control group. Finally, we found that MB at a concentration of 15 mg/kg/day improved the cognitive abilities of mice, while negative correlation between the content of Deferribacteres and cognitive parameters was revealed. Our data expand the understanding of the relationship between MB, cognitive abilities, and gut microbiome in respect to the antibacterial properties of MB.