The invention belongs to the technical field of wastewater treatment and particularly relates to a microbial agent suitable for treating urban wastewater and a preparation method thereof. The microbial agent comprises Bacillus subtilis, Bacillus licheniformis, Bacillus megaterium, saccharomycetes, lactic acid bacteria, acetic acid bacteria, photosynthetic bacteria, Actinobacteria, indigenous bacteria, nitrifying bacteria, denitrifying bacteria, phosphorus-accumulating bacteria, Rhodospirillum, Thiobacillus denitrificans, Sphingobacteria, Alcaligenes faecalis, Bifidobacterium, brown rot fungi,Geotrichum candidum, Mucor, Aspergillus oryzae, and Penicillium diversum. The preparation method includes: mixing well Actinobacteria, indigenous bacteria, nitrifying bacteria, denitrifying bacteria,phosphorus-accumulating bacteria and Bifidobacterium, adding the mixture into clean soil, farming earthworms with the soil for 12-14 days, and isolating the earthworms and the soil to obtain earthwormcast containing the mixed bacteria; mixing the earthworm cast containing the mixed bacteria and other bacteria, and immobilizing to obtain the microbial agent.