| [Objective] The aim of present research was to explore the spatiotemporal distribution changes of harmful gases (NH3, CO2, H2S), bacteria and fungi contents in the air of cowshed of different building types, and analyze the spatial distribution rules of microorganisms in and out of the barns (including inside and outside the cowshed). [Methods] Three types of cowshed were selected in in Guanzhong area of Shaanxi province: Semi-open, open and closed cattle farms, and bacteria, fungi, harmful gas, temperature and humidity in and out of the cattle farms in different periods were detected and analyzed simultaneously. [Results] During the test, the ammonia concentration, hydrogen sulfide concentration and carbon dioxide concentration of the three kinds of cowshed were all within the allowed range of the environmental quality standard of livestock and poultry farm, and the bacteria and fungi exceeded the standard in some time and places. The air quality of the closed cowshed was significantly worse than that of the semi-open cowshed and the fully open cowshed. [Conclusion] The air quality of cowshed in different building types and different time periods basically meets the national standards and basically meets the requirements of beef cattle growing and fattening. The enclosed cowshed needs to develop a reasonable ventilation and ventilation program.