BackgroundPrior research suggests polyunsaturated fatty acids (PUFA) may prevent gallstones, but evidence on saturated fatty acids (SFA) and monounsaturated fatty acids (MUFA) is limited. This study aims to explore the associations between fatty acids and gallstones using a large sample of American population and Mendelian randomization (MR) methods.MethodsThe cross-sectional study involved 6,629 participants from the National Health and Nutrition Examination Survey (NHANES) 2017–2020. Logistic regression and restricted cubic spline (RCS) analysis were conducted after stratifying by gender subgroups. Two-sample MR analysis was used to explore the causal relationship between fatty acids and gallstones without confounding factors.ResultsIn females, higher SFA intake was positively associated with gallstone risk, while higher intake of n-3 and n-6 PUFA was negatively associated. No significant associations were found in males. No nonlinear correlations were found in any group by RCS analysis. MR analysis indicated that SFA, n-3, and n-6 PUFA could reduce gallstone risk.ConclusionThe influence of dietary fatty acid composition on gallstone development differs by gender, providing insights into dietary prevention and treatment of gallstones.