The competition between weeds and crops for soil nutrients is affected by soil microorganisms, which drive diverse ecological processes and are critical in maintaining the stability of agroecosystems. However, the effects of plant species identity, particularly between forage and weed, on soil microbial diversity, composition, and association are not well understood. Here, we investigate the soil physicochemical properties and bacterial/fungal communities in an agroecosystem with native alfalfa [Medicago stativa (Ms)] and five common weed species (Digitaria sanguinalis, Echinochloa crusgalli, Acalypha australis, Portulaca oleracea, and Chenopodium album) in the North China Plain. The five weeds had a lower plant carbon content than Ms. while the opposite was true for plant nitrogen and phosphorus concentrations. The Shannon diversity of bacterial and fungal communities of the five weeds were significantly lower than in Ms. Soil pH and PO43−-P were identified as the most important factors in shaping the relative abundances of bacteria (Sphingomonadaceae) and fungi (Pleosporaceae), respectively. Importantly, the weeds greatly inhibited the growth of pathogenic fungi (Nectriaceae and Pleosporaceae). Bacterial co-occurrence networks depended on specific species, indicating that Ms. harbored co-occurrence networks that were more complex than those in the bacterial communities of other weed groups. Our study examines how soil nutrients and the soil microbial community structure of five weed species changed in an Ms. field. This analysis of the microbial ecological network enhances our understanding of the influence of weeds on the soil microbiome in agroecosystems.