Obesity is rising globally and is associated with neurodevelopmental and psychiatric disorders among children, adolescents and young adults. Whether obesity is the cause or the consequence of these disorders remains unclear. To examine the behavioural effects of obesity systematically, locomotion, anxiety and social behaviour were assessed in male and female C57Bl/6J mice using the open field, elevated plus maze and social preference task. First, the effects of age and sex were examined in control mice, before investigating post‐weaning consumption of a high fat–high sugar diet commonly consumed in human populations with high rates of obesity. In the open field and elevated plus maze, locomotor activity and anxiety‐related behaviours reduced with aging in both sexes, but with different sex‐specific profiles. The high fat–high sugar diet reduced food and calorie intake and increased body mass and fat deposition in both sexes. In the open field, both male and female mice on the obesogenic diet showed reduced locomotion; whereas, in the elevated plus maze, only females fed with the obesogenic diet displayed reduced anxiety‐related behaviours. Both male and female mice on the obesogenic diet had a significantly higher social preference index than the control group. In conclusion, the findings demonstrate that the behavioural effects of age and diet‐induced obesity all depend on the sex of the mouse. This emphasises the importance of considering the age of the animal and including both sexes when assessing behavioural phenotypes arising from dietary manipulations