The association of macronutrients intake with body composition and sarcopenic obesity remains uncertain in children and adolescents. We aimed to explore the association between macronutrients intake and body composition, especially sarcopenic obesity, in children and adolescents residing in the United States. The study utilized data from 5412 participants aged 6–17 years who attended NHANES between 2011 and 2018. Body composition was assessed using DXA, and nutrient intake was based on 24-h recall. Multivariable linear regression and multinomial logistic regression were used. The unweighted prevalence of sarcopenic obesity was 15.6%. A higher percentage of energy (5 %E) from fat was inversely associated with muscle mass but positively associated with fat mass and sarcopenic obesity. Substituting carbohydrate (5 %E) with fat decreased muscle mass by 0.03 (95% CI 0.01 to 0.06) but increased fat mass by 0.03 (95% CI 0.01 to 0.06) and increased the prevalence of sarcopenic obesity by 254% (95% CI 15% to 487%). Replacing protein intake with fat intake also increased the OR of sarcopenic obesity (OR, 2.36 [95% CI 1.18 to 3.18]). In conclusion, a high-fat diet, coupled with low carbohydrate/protein intake, is associated with sarcopenic obesity among children and adolescents. The change in children’s diet towards a healthy diet with low fat composition may help prevent sarcopenic obesity. However, randomized clinical trials or longitudinal studies are needed to further validate our findings.