Mr Di Pietro wrote a letter to the man preparing to head the new government, Romano Prodi, saying he would accept an offer to head the Public Works Ministry but that he would remain independent as a "technocrat external to the governing coalition".
The decision was an important boost to Mr Prodi's government-forming efforts, because Mr Di Pietro has been considered a major political prize whom both left and right have tried to capture. He is regularly voted the country's most popular public figure, and one poll suggested he would have won the recent general elections, had he run for office.
Members of the centre-right opposition barely concealed their disappointment yesterday, accusing Mr Di Pietro of making an unprincipled choice based on thirst for power.
The former magistrate is particularly well-suited to the Public Works Ministry because it will give him the chance to attack the main source of political corruption in Italy - the handling of public contracts. When Mr Di Pietro challenged the system of contract 'kickbacks' four years ago, from the Milan prosecutor's office, he brought down the entire Italian ruling order.
Mr Di Pietro resigned from the magistrature at the end of 1994, in somewhat mysterious circumstances, and has since struggled to find a role. He conducted negotiations with leaders of all the main political parties but stayed out of the recent election campaign because of a series of judicial smears that he has only just shaken off.
A conservative by instinct, it appears he was tempted for a long time to join the centre-right coalition headed by the former prime minister Silvio Berlusconi, either as an ally or as an alternative leader. But Mr Berlusconi himself proved too big an obstacle, since one of Mr Di Pietro's last judicial investigations was into the media magnate's business empire, and the two men are irreconcilably at odds.
Negotiations with Mr Prodi were equally unpromising at first, because Mr Di Pietro wanted a big ministry - Interior or Justice. The Public Works Ministry - apparently first suggested by Mr Prodi's niece,emerged as a useful compromise. It is not a particularly sensitive position politically, and it will allow Mr Di Pietro to do what he does best, with an authority that few other public figures could ever hope to match.