Obesity is associated with a high prevalence of mood disorders such as anxiety and depression. Both stress and high fat diet can alter the gut microbiota and contribute to obesity. To examine the interrelationships between obesity, stress, gut microbiota and mood disorders, obesity was induced in mice using a high fat diet, and the mice were subsequently stressed using a chronic unpredictable mild stress protocol. During the experiment, the composition of the gut microbiota was analyzed by 16 S rRNA gene high-throughput sequencing, and anxiety-like behaviors were measured. The results revealed distinct gender differences in the impacts of obesity and stress on anxiety-like behaviors, activity levels, and composition of the gut microbiota. Male mice were more vulnerable to the anxiogenic effects of the high fat diet, and obese male mice showed decreased locomotion activity in response to stress whereas obese female mice did not. In females, stress caused the gut microbiota of lean mice to more closely resemble that of obese mice. Taken together, these results suggest the importance of considering gender as a biological variable in studies on the role of gut microbiota in obesity-related mood disorders.