Method for controlling a thermal engine comprising a turbocharger with an expansion part t formed by a turbine and an exhaust gas bypass pipe equipped with a means for controlling opening the passage of the exhaust gases in the conduit, method in which: The pressure (P 4) downstream of the expansion part of the turbocharger is determined, total exhaust gas flow (ṁ Echappement) produced by the heat engine is determined, The aperture (Op) of the aperture control means is determined, characterized in that the method comprises a step of determining the flow rate (ṁ Turbine) of exhaust gas passing through the turbine and the pressure (P 3) of the exhaust gas upstream of the expansion part of the turbocharger by solving by iteration a system of equations comprising: - a first expression in which the pressure (P 3) of the exhaust gas upstream of the expansion part of the turbocharger is expressed from the pressure (P 4) downstream of the expansion part of the turbocharger and the flow rate (ṁ Turbine) of exhaust gas passing through the turbine, - a second expression in which the flow rate (ṁ Turbine) of exhaust gas passing through the turbine is expressed from the difference in the flow rate (ṁ Echappement) of total exhaust gas produced by the heat engine and a flow rate (ṁ Wastegate) of exhaust gas passing through the bypass pipe determined by a first relationship: m ̇ Wastegate _ BSV = S WG × φ P 4 P 3 × P 3 T 3 Where: • ṁ Wastegate_BSV is the value of the flow rate of exhaust gas passing through the bypass pipe obtained by this first relation. • S WG is the cross section of the means for controlling the opening of the passage of the exhaust gases in the duct by-pass. • φ is the Barre de St Venant function between the pressure (P 3) of the exhaust gases upstream of the expansion part of the turbocharger and the pressure (P 4) of the exhaust gases downstream of the expansion part of the turbocharger. • T 3 is the temperature determined upstream of the expansion part of the turbocharger. The pressure (P 4) downstream of the expansion part of the turbocharger is determined, total exhaust gas flow (ṁ Echappement) produced by the heat engine is determined, The aperture (Op) of the aperture control means is determined, characterized in that the method comprises a step of determining the flow rate (ṁ Turbine) of exhaust gas passing through the turbine and the pressure (P 3) of the exhaust gas upstream of the expansion part of the turbocharger by solving by iteration a system of equations comprising: - a first expression in which the pressure (P 3) of the exhaust gas upstream of the expansion part of the turbocharger is expressed from the pressure (P 4) downstream of the expansion part of the turbocharger and the flow rate (ṁ Turbine) of exhaust gas passing through the turbine, - a second expression in which the flow rate (ṁ Turbine) of exhaust gas passing through the turbine is expressed from the difference in the flow rate (ṁ Echappement) of total exhaust gas produced by the heat engine and a flow rate (ṁ Wastegate) of exhaust gas passing through the bypass pipe determined by a first relationship: m ̇ Wastegate _ BSV = S WG × φ P 4 P 3 × P 3 T 3 Where: • ṁ Wastegate_BSV is the value of the flow rate of exhaust gas passing through the bypass pipe obtained by this first relation. • S WG is the cross section of the means for controlling the opening of the passage of the exhaust gases in the duct by-pass. • φ is the Barre de St Venant function between the pressure (P 3) of the exhaust gases upstream of the expansion part of the turbocharger and the pressure (P 4) of the exhaust gases downstream of the expansion part of the turbocharger. • T 3 is the temperature determined upstream of the expansion part of the turbocharger. - a first expression in which the pressure (P 3) of the exhaust gas upstream of the expansion part of the turbocharger is expressed from the pressure (P 4) downstream of the expansion part of the turbocharger and the flow rate (ṁ Turbine) of exhaust gas passing through the turbine, - a second expression in which the flow rate (ṁ Turbine) of exhaust gas passing through the turbine is expressed from the difference in the flow rate (ṁ Echappement) of total exhaust gas produced by the heat engine and a flow rate (ṁ Wastegate) of exhaust gas passing through the bypass pipe determined by a first relationship: m ̇ Wastegate _ BSV = S WG × φ P 4 P 3 × P 3 T 3 • ṁ Wastegate_BSV is the value of the flow rate of exhaust gas passing through the bypass pipe obtained by this first relation. • S WG is the cross section of the means for controlling the opening of the passage of the exhaust gases in the duct by-pass. • φ is the Barre de St Venant function between the pressure (P 3) of the exhaust gases upstream of the expansion part of the turbocharger and the pressure (P 4) of the exhaust gases downstream of the expansion part of the turbocharger. • T 3 is the temperature determined upstream of the expansion part of the turbocharger.