A process for treating sludge, said sludge to be treated being categorized into two categories, easy sludge 10, and difficult sludge 12, "difficult sludge" denoting any organic matter of which the mesophilic digestion at 35-40° C. for 20 days does not make it possible to convert into biogas, consisting of methane, more than 40% of the organic matter initially present, "easy sludge" denoting any organic matter of which the mesophilic digestion at 35-40° C. for 20 days makes it possible to reduce the organic matter present by more than 40%, in order to produce energy and/or organic matter which has been rendered hygienic, comprising a first step of mesophilic or thermophilic digestion of one fraction of a stream of organic waste, comprising at least "easy sludge" in a first digester dimensioned for a residence time of between 9 and 19 days, said fraction being beforehand heated in a heat exchanger characterized in that it comprises the following steps: - a step of mixing the digested sludge leaving the digester with the "difficult sludge" which has not been introduced into the digester, - a step of dehydration of all of the digested and undigested waste, undigested waste being all or part of the difficult sludge, the dehydration being carried out to 10-20% of dry matter, - a step of aerated thermal hydrolysis of the dehydrated waste, with the injection of an oxidizing agent in an amount lower than the stoichiometric amount for the oxidation of the organic matter, and setting to the required temperature via a heating means, - a step in which the flow of organic waste at the outlet of the thermal hydrolysis undergoes a heat exchange to supply calories to a water loop, in particular with regulation of the temperature of the organic waste in exit from thermal hydrolysis and dilution, - a step of injecting water into the waste stream upstream of the inlet of the second digester to dilute the stream and control the operation of the second digestion, in a second digester dimensioned for a residence time of between 9 and 19 days, - and a second mesophilic or thermophilic step of digestion of the stream of hydrolyzed waste, separate from the first digestion step. - a step of mixing the digested sludge leaving the digester with the "difficult sludge" which has not been introduced into the digester, - a step of dehydration of all of the digested and undigested waste, undigested waste being all or part of the difficult sludge, the dehydration being carried out to 10-20% of dry matter, - a step of aerated thermal hydrolysis of the dehydrated waste, with the injection of an oxidizing agent in an amount lower than the stoichiometric amount for the oxidation of the organic matter, and setting to the required temperature via a heating means, - a step in which the flow of organic waste at the outlet of the thermal hydrolysis undergoes a heat exchange to supply calories to a water loop, in particular with regulation of the temperature of the organic waste in exit from thermal hydrolysis and dilution, - a step of injecting water into the waste stream upstream of the inlet of the second digester to dilute the stream and control the operation of the second digestion, in a second digester dimensioned for a residence time of between 9 and 19 days, - and a second mesophilic or thermophilic step of digestion of the stream of hydrolyzed waste, separate from the first digestion step.