<p>The spatiotemporal changes of nitrate in agricultural watersheds are of global concern. Although numerous studies have explained the source and transformation mechanism of nitrate in groundwater and surface water, the transformation mechanism in groundwater remains poorly understood because of different hydrogeological and climatic conditions. Based on a field investigation and sampling, this study revealed the sources and transformation mechanism of nitrogen in surface water and groundwater in a karst agricultural watershed by comprehensively using water chemistry data, isotope components, and a Bayesian model (simmr). The results indicated that:1)Local agricultural activities have controlled the changes of &#948;<sup>15</sup>N-NO<sub>3</sub><sup>-</sup>, &#948;<sup>18</sup>O-NO<sub>3</sub><sup>-</sup> and &#948;<sup>15</sup>N-NH<sub>4</sub><sup>+</sup> in groundwater. The difference is that the concentration of NO<sub>3</sub><sup>-</sup> is significantly affected by rainfall. However, the contribution of rainfall to groundwater NO<sub>3</sub><sup>-</sup> is relatively small (<9%), indicating that there is a dual influence mechanism of leaching in the watershed that controls the concentration of groundwater NO<sub>3</sub><sup>-</sup>, while agricultural activities control its isotope changes;2)The study observed that after fertilization, due to the influence of ammonia volatilization and nitrification, &#948;<sup>15</sup>N-NO<sub>3</sub><sup>-</sup>, &#948;<sup>18</sup>O-NO<sub>3</sub><sup>-</sup> in groundwater showed a simultaneous decrease, while &#948;<sup>15</sup>N-NH<sub>4</sub><sup>+</sup> showed an increasing trend, which may be due to the result of incomplete nitration of NH<sub>4</sub><sup>+</sup> in the vadose zone;3)According to the calculation results of the simmr model, in the two main fertilization periods in October 2018 and April 2019, the contribution of chemical fertilizers to groundwater NO<sub>3</sub><sup>-</sup>reached the peak value(65% and 69%), which is in line with the seasonal variations of &#948;<sup>15</sup>N-NO<sub>3</sub><sup>-</sup>, &#948;<sup>18</sup>O-NO<sub>3</sub><sup>-</sup>and &#948;<sup>15</sup>N-NH<sub>4</sub><sup>+</sup>;4)The surface water in the watershed is mainly supplied by groundwater, and the contribution of chemical fertilizers to surface water NO<sub>3</sub><sup>-</sup> is generally higher than that of groundwater. This may be caused by the drainage of rice fields containing chemical fertilizers into the river.</p>