The gut microbiota of animals plays a crucial role in bridging host and ecosystem functions. [Objective] We aimed at assessing the effects of ryegrass application and different sampling periods of rice growth stages on the composition and structure of soil bacterial and nematode gut bacterial communities and exploring their potential linkages. [Methods] Based on a pot experiment, soil bacterial and nematode gut bacterial communities in the early (green returning period) and later (harvest period) stages of rice growth under ryegrass application and control treatments were analyzed by using 16S rRNA gene high-throughput sequencing technology. The potential impact of soil bacterial interactions on nematode gut bacterial communities was further studied with the network analysis. [Results] Ryegrass application did not significantly affect the composition and structure of soil and nematode gut bacterial communities (P>0.05). The later samples had higher alpha diversity than earlier ones. Extensive and significant correlations between soil bacterial and nematode gut bacterial biomarkers were obtained based on random forest machine learning, providing strong evidence that soil bacterial community changes regulate intestinal bacterial community composition of nematodes. Co-occurrence network-based analysis showed that positive interactions among soil bacteria were significantly (P<0.01) positively correlated with positive interactions between soil and nematode gut bacteria, thereby influencing network interactions among nematode gut bacteria. Structural equation modeling (SEM) further showed that the reduction of soil nutrients indirectly affected the network interactions among nematode gut bacteria mainly by reducing the positive network interactions among soil bacteria. [Conclusion] Soil bacterial interactions may play important roles in regulating network interactions and community composition of nematode gut bacteria.