The TikTokers, Mubarak Muhammad alias Unique Pikin and Nazifi Muhammad, had pleaded guilty and asked for leniency.
But the judge ordered them to be given 20 lashes each, to pay a fine of 10,000 naira (£20; £17) and to clean the court premises for 30 days.
They were also ordered to publicly apologize to Mr Ganduje on social media.
Amnesty International said the “cruel sentences must be quashed” and that the young TikTok stars “must be immediately and unconditionally released”.
Parts of the sentences have been carried out. The pair were whipped in public in the court’s premises and have paid the fine.
Their lawyer said they would not appeal against the judgement.
Nigeria has seen a growing number of social media stars who use comedy to comment on social and political issues – attracting massive followers to their accounts.
Source: BBC