Evidence suggests an association between obesity and the risk for cardiomyopathy development; however, robust evidence is still lacking. In this study we sought to explore the relationship of obesity with hypertrophic cardiomyopathy (HCM) and dilated cardiomyopathy (DCM) and possible interactions with sex using large-scale epidemiological real-world data. We analysed data from the Nationwide Inpatient Sample of US hospitalisations for the years 2015–2019. There were a total of 46 934 admissions with diagnosis of HCM and 170 924 with DCM. There was a significant interaction between cardiomyopathies' diagnosis with sex and age subgroups; the rates of both DCM and HCM increased with age (p < .001 for both); DCM diagnosis was significantly higher in males compared with females (0.85% vs. 0.35%, p < .001). After adjustment for age, sex, race and presence of arterial hypertension there was a significant stepwise positive association between obesity and the population rates of both cardiomyopathy subtypes. For hospitalised patients with a body mass index (BMI) ≥30 kg/m2 there was an odds ratio (OR) of 1.68 (95% CI: 1.55–1.81, p < .001) for HCM and OR = 1.82 (95% CI: 1.79–1.84, p < .001) for DCM. More importantly, the positive relationship between a cardiomyopathy diagnosis (HCM or DCM) with increasing BMI was driven by the male sex (p < .001 for both) and it was non-significant in females. The findings from this nationwide observational analysis support a sexual dimorphism in the relationship between obesity and HCM or DCM, which should be further investigated.