Abstract Heavy metal pollution of groundwater can have severe potential impacts on human health and the environment. The aim of this study was to evaluate the spatial distribution, pollution, and health risk of heavy metals in groundwater in the main pepper production area of China. A total of 67 groundwater samples were collected, and the concentrations of cadmium (Cd), chromium (Cr), copper (Cu), nickel (Ni), manganese (Mn), and zinc (Zn) elements were analyzed. The results indicated that the average concentrations of Cd, Cr, Cu, Mn, Ni, and Zn in groundwater are lower than the limits of the Standard for Groundwater Quality of China (Class III). However, the maximum concentrations of Mn, Cd, and Ni surpass the Standard for Groundwater Quality of China. The spatial distribution patterns of the concentrations and pollution levels of the six heavy metals in groundwater to be substantially heterogeneous. Furthermore, the pollution level of heavy metals in groundwater decrease in the following order: Mn > Cd > Ni > Cr > Zn > Cu, and the collected groundwater samples are found to be slightly polluted by heavy metals. Overall, the non-carcinogenic risk of the investigated metals, instigated primarily by oral ingestion of groundwater, are found to be higher than the acceptable range for children, and Cd poses the most significant health risk among the investigated metals.