The experiment aims to measure the degree of contamination of heavy metals in soil. This paper takes Dunhua District, Taiyuan City as an example to detect heavy metals in soil of five sampling sites through the fuzzy mathematics and the atomic absorption method. With the consideration of soil pH values, the soil quality of sampling sites is finally evaluated by fuzzy mathematics. The results show that the average pH value of the experimental soil samples is 8.02, which is weakly alkaline soil. The population degree of the west of Dongjiying is the highest, while that of Echi is the lowest.