The Dibei gas field is a large tight gas field located in the Kuqa subbasin, Tarim Basin, northwestern China. The reservoir is within the Lower Jurassic Ahe Formation (J1a) and has porosity and permeability ranges of 2%–8% and 0.01–1 md, respectively. Two episodes of hydrocarbon charge are identified based on a detailed study of fluid-inclusion petrography and microthermometry, fluorescence spectroscopy characteristics, and the thermal maturity of both gas and light oil. Low-maturity oil as represented by hydrocarbon inclusions with yellow-green fluorescence entered the reservoir circa 23–12 Ma, whereas high-maturity hydrocarbons, as indicated by hydrocarbon inclusions with blue-white fluorescence, have charged the reservoir since 5 Ma. The hydrocarbon charge process combined with porosity evolution determined the present gas–water distribution characteristics in the Dibei gas field. Porosity in the J1a sandstone reservoir was relatively high during the first episode of hydrocarbon charge, which allowed oil to migrate upward and accumulate in structural highs under buoyancy. From 5 Ma to the present, the Dibei gas field experienced strong tectonic compression associated with intense thrust-fault reactivation, causing deformation and oil leakage from the reservoir. Continuous tight sand deposits along the slope areas, located far away from the active faults, became favorable accumulation sites for gas derived from the underlying Triassic source rocks. Hydrocarbon accumulation along the slope area in the Ahe Formation is dominantly controlled by equilibrium between hydrocarbon-generation pressure and capillary pressure.