The “ecological ditch” (eco-ditch) is an effective measure used to alleviate agricultural non-point-source pollution. However, information is lacking about the continuous transport characteristics of internal and external nitrogen and phosphorus in the interstitial water of the bottom mud of these ditches and overlying water under dynamic continuous inflow conditions. Understanding of the effect of matrix dams and microbial communities inside eco-ditches on the continuous transport characteristics of the N and P therein needs to be improved. To determine the interception effects of eco-ditches on the transfer of endogenous and exogenous N and P, an eco-ditch combining plants and a matrix dam was built to explore the transport distribution characteristics of N and P in the intermittent water and overlying water in the bottom of the eco-ditch and in the bottom of the soil ditch. We compared and analyzed the composition characteristics of the microbiological communities along the ecological and soil ditches. The research results showed that: (1) The concentration gradient between the interstitial water and the overlying water in the soil ditch is the main reason for the transport and diffusion of pollutants. However, in eco-ditches, the absorption function of plant roots and the differences between the structures of the microbial communities destroy the correlation of this concentration gradient diffusion, especially the effect on ammonium N; (2) a large number of mycelia adhere to the surface of the matrix dam in an eco-ditch, and are conducive to the adsorption and purification of pollutants in the water; (3) Proteobacteria, Chloroflexi, Actinomycetes, and Acidobacteria were the main bacterial groups in the ditches. The aquatic plants in the eco-ditch changed the microenvironment of the sediment, and both the microbial diversity and abundance along the eco-ditch were higher than in the soil ditch.