The main objective of this study was to analyze dietary patterns using data-driven approaches and to explore preventive or risk dietary factors for kidney stone disease (KSD). A case–control matching study was conducted in adults (n = 6396) from a suburb of Shanghai. A food frequency questionnaire was used to assess the consumption of various types of food, and B-ultrasound was used to identify kidney stones. Principal component analysis and regression were used to generate dietary patterns and further explore the relationship between dietary patterns and KSD. LASSO regression and post-selection inference were used to identify food groups most associated with KSD. Among males, the “balanced but no-sugary-beverages pattern” (OR = 0.78, p p p p p p p p p < 0.05) were protective factors.