In order to understand the status of soil heavy metals and risk element pollution and its impact on human health, Datong area of Shanxi Province was selected as the study area. Using spss19 statistical software, the degree of soil heavy metals and risk element pollution, ecological risk and health risk were evaluated by using land accumulation index method, potential ecological hazard index method and health risk assessment model. The results showed that there were different degrees of pollution of heavy metals and risk element Pb, Cr, Zn, Cd, Ni, As, Hg and Cu in farmland soil in Datong area. The soil Pb pollution was the most serious. There were 8 light pollution points, 3 medium pollution points, 1 heavy~extremely heavy pollution point and 1 extremely heavy pollution point, accounting for 3.24%, 1.21%, 0.4% and 0.4% respectively. The distribution range of the total potential ecological index RI of heavy metals and risk element in farmland soil is 28.00~1851.01. There are slight, secondary, strong, very strong and extremely strong ecological risks, accounting for 97.57%, 1.21%, 0.4%, 0.4% and 0.4% respectively. The main risk factors are slight risks, and the influencing factors are Cd, Pb, Cu, Hg and As. Heavy metals and risk element in farmland soil have non-carcinogenic health risks for adults and children. Cr and As are the main non-carcinogenic factors in the soil of the study area; The average value of the total carcinogenic risk index is between 10 -6 and 10 -4 , which will not cause great harm to the health of local residents.