The Milan court ruled Berlusconi must spend at least four hours a week in a centre for the elderly for one year.
He will not be allowed to travel outside Lombardy, the region around Milan where he has his principal residence, except for restricted trips to Rome.
Following the definitive tax fraud conviction last year, Berlusconi was stripped of his seat in the Italian Senate and barred from holding public office for two years.
But the 77-year-old remains the most influential politician on Italy's centre-right as leader of the Forza Italia party.
A statement from the court did not say whether Berlusconi would be allowed to campaign for the election while in Lombardy and Rome and what role he could play in public life, if any, over the coming year.
It said the trips to Rome could take place weekly, from Tuesday to Thursday, with Berlusconi ordered to be back in Lombardy by 11 pm each Thursday.
His lawyers said in a statement the ruling "appears balanced and satisfactory even with regards to the needs of political activity".
They, like Milan prosecutors, had argued in favour of his doing community service rather than being sent to prison or put under house arrest.
A legal source said the media tycoon would do his community service at the Sacred Family Foundation in Cesano Boscone, a small town near Milan. Its website says the centre cares for the elderly and people with disabilities.
The four-time prime minister has dominated Italian politics since the mid-1990s but was expelled from the Senate last November after being convicted of masterminding a complex system of tax fraud.
His four-year jail sentence was commuted to one year under a law aimed at reducing prison overcrowding.