Studying the effects of precipitation on carbon exchange in grassland ecosystems is critical for revealing the mechanisms of the carbon cycle. In this study, the eddy covariance (EC) technique was used to monitor the carbon fluxes in a grassland ecosystem in the Badain Jaran Desert (BJD) during the growing season from 2018 to 2020. The responses of net ecosystem CO2 exchange (NEE), ecosystem respiration (Reco), and gross primary productivity (GPP) to precipitation were analysed, as well as the effects of environmental factors on carbon fluxes at half-hour and daily scales. The results showed that (1) during the growing seasons in 2019 and 2020, the grassland ecosystem in a lake basin in the BJD was a net CO2 sink, and the cumulative NEE was - 91.9 and - 79.2g C m-2, respectively. The greater the total precipitation in the growing season, the stronger the carbon sequestration capacity of a grassland ecosystem. (2) The precipitation intensity, frequency, and timing significantly affected the carbon fluxes in the ecosystem. Isolated minor precipitation events did not trigger obvious NEE, GPP, and Reco pulses. However, large precipitation events or continuous minor precipitation events over several days caused delayed high assimilation; in addition, the greater the precipitation intensity, the greater the carbon flux pulse and carbon assimilation. The timing and frequency of precipitation events had more important effects on carbon exchange than total precipitation. Droughts create a shift in grasslands, causing them to move from being a carbon sink to a carbon source. (3) Correlation analysis showed that NEE was significantly negatively correlated with photosynthetically active radiation (PAR). On the half-hour scale, Reco and GPP were significantly positively correlated with soil temperature at 5 cm deep (Ts5) and PAR, respectively. However, they were strongly correlated with air temperature (Ta), soil surface temperature (Ts) and (Ts5)on the daily scale. The correlations between daily NEE, Reco, GPP, and precipitation varied across years and seasons. Due to warming and humidification in northwest China, precipitation events will have a greater impact on the carbon sequestration capacity of the BJD. The results are vital for predicting the possible effects of climate change on the carbon cycle.