Mr Gandhi was convicted by the court in Gujarat state for 2019 comments about Prime Minister Narendra Modi's surname during an election rally.
He will not go to jail immediately - he has been given bail for 30 days and can file an appeal against his conviction.
The Congress party MP was present in court for sentencing, which comes a year before general elections are due.
Speaking at an election rally in Karnataka state in April 2019, ahead of the last general election, Mr Gandhi had said: "Why do all thieves have Modi as their surname? Nirav Modi, Lalit Modi, Narendra Modi."
Nirav Modi is a fugitive Indian diamond tycoon while Lalit Modi is a former chief of the Indian Premier League who has been banned for life by the country's cricket board.