Purpose: This study aims to explore the relationship between soy food consumption and gastric cancer (GC) risk, accounting for Helicobacter pylori infection status. Materials and Methods: We analyzed data from patients with GC and healthy individuals prospectively enrolled by 6 hospitals between 2016 and 2018. Dietary intake was evaluated using questionnaires that categorized seven dietary habits and 19 food groups. Multivariate logistic regression models were applied to examine associations. Model I adjusted for various epidemiological factors, while Model II included further adjustments for H. pylori infection. Primary exposures examined were consumption frequencies of nonfermented, unsalted soy foods (soybean/tofu) and fermented, salty soy foods (soybean paste stew). Results: A total of 5,535 participants were included, with 1,629 diagnosed with GC. In Model I, the frequency of soybean/tofu consumption was inversely related to GC risk; adjusted odd ratios (aORs) were 0.62 (95% confidence interval [CI], 0.48-0.8), 0.38 (95% CI, 0.3-0.49), 0.42 (95% CI, 0.33-0.53), and 0.33 (95% CI, 0.27-0.42) for 1 time/week, 2 times/week, 3 times/week, and ≥4 times/week. Consumption of 2 servings/week of soybean paste stew showed the lowest GC association, forming a V-shaped curve. Both low (aOR, 4.03; 95% CI, 3.09-5.26) and high serving frequencies of soybean paste stew (aOR, 2.23; 95% CI, 1.76-2.82) were associated with GC. The association between soy foods and GC in Model II was similar to that in Model I. The soy food-GC associations were consistent across sexes in Model I. Nonetheless, the positive correlation between frequent consumption of soybean paste stew (≥5 times/week) and GC was more pronounced in women (aOR, 7.58; 95% CI, 3.20-17.99) compared to men (aOR, 3.03; 95% CI, 1.61-5.88) in Model II. Subgroup analyses by H. pylori status and salty diet revealed a consistent inverse relationship between soybean/tofu and GC risk. In contrast, soybean paste stew showed a V-shaped relationship in H. pylori-positive or salty diet groups and no significant association in the H. pylori-negative group. Conclusions: Soybean/tofu intake is consistently associated with a decreased risk of GC. However, the relationship between soybean paste stew consumption and GC risk varies, depending on H. pylori infection status and dietary salt intake.