Gut immunocompetence involves immune, stress and regenerative processes. To investigate the determinants underlying inter-individual variation in gut immunocompetence, we perform enteric infection of 140 Drosophila lines with the entomopathogenic bacterium Pseudomonas entomophila and observe extensive variation in survival. Using genome-wide association analysis, we identify several novel immune modulators. Transcriptional profiling further shows that the intestinal molecular state differs between resistant and susceptible lines, already before infection, with one transcriptional module involving genes linked to reactive oxygen species (ROS) metabolism contributing to this difference. This genetic and molecular variation is physiologically manifested in lower ROS activity, lower susceptibility to ROS-inducing agent, faster pathogen clearance and higher stem cell activity in resistant versus susceptible lines. This study provides novel insights into the determinants underlying population-level variability in gut immunocompetence, revealing how relatively minor, but systematic genetic and transcriptional variation can mediate overt physiological differences that determine enteric infection susceptibility.