At present, systematic analysis of the main pollution sources of blaTEM resistance genes in dairy products in Beijing had not been reported. In order to understand the main pollution sources of drug-resistant microorganisms and drug-resistant genes in dairy products. It had been taken as the research object that drug-resistant microorganisms in dairy products and corresponding farm environmental samples, Adenosine triphosphate(ATP) fluorescence detection and Polymerase Chain Reaction(PCR) methods were used to analyzed the distribution of milking contamination and build a molecular development tree to traced the potential pollution sources of blaTEM drug resistance genes. The results showed that the contamination risk was relatively high of some pipeline interfaces with more contact with the outside world in the milking process, and there were great differences in microbial drug resistance among different pastures, in which the detection rate of ampicillin resistant strains at 61.5%. The detection rate was as high as 95.3% of β-lactam antibiotic blaTEM resistance gene in environment and milk samples, and milking was the blaTEM genes potential link of pollution, and drinking water might be the main source of pollution. In summary, the pasture is a potential contamination link of drug-resistant microorganisms and blaTEM resistance genes in dairy products. There is a risk that blaTEM resistance genes will migrate along the production chain.