1 ) A method of treating the exhaust gas of an internal-combustion engine equipped with a particulate filter and an oxidation catalyst arranged upstream from said filter, wherein active regeneration of said filter is controlled by means of a dynamic control of a temperature T2 of said gas leaving said oxidation catalyst, characterized in that it comprises the following stages: i—determining a set point temperature Tc of said gas leaving said catalyst so as to provide active regeneration of said filter, ii—determining a temperature demand necessary for control of said temperature T2, iii—determining a stationary gain G defined as the ratio between the stationary value of a variation of T2 and a stationary value of a hydrocarbon mass flow rate variation that has induced said variation of T2, iv—correcting said gain G so as to take into account a gas flow rate variation at the inlet of said catalyst, the gain being transiently increased in relation to G for a gas flow rate increase and transiently decreased in relation to G for a gas flow rate decrease, v—defining a control law for a hydrocarbon flow rate at the inlet of said oxidation catalyst, through the ratio of said temperature demand and said corrected gain, vi—modifying the hydrocarbon flow rate by applying the control law so that the temperature of said gas leaving said catalyst meets said set point temperature.