Indonesian President Joko Widodo has traded barbs with election rival Prabowo Subianto over issues including corruption and law enforcement in their first televised debate three months before the world's third-biggest democracy goes to the polls.

The April 17 contest mirrors the 2014 race when Widodo narrowly beat the retired general to become the country's first president from outside its political and military elite. Both have chosen different running mates this time around.

Halfway into the campaign, most opinion polls gave 57-year-old Widodo, popularly known as Jokowi, a healthy double-digit lead over Prabowo.

But with up to a quarter of voters still undecided, the gap may narrow.

On Thursday, during the debate that was broadcast across the vast archipelago, candidates and their running mates were questioned for around two hours over human rights, corruption and terrorism.

Widodo said his team offered "optimism", while Prabowo, 67, highlighted the poverty and income inequality he said were holding back much of the country's more than 250 million people.

Dressed in a white shirt, Widodo at times appeared agitated while defending his record, as his rival repeatedly questioned the country's legal system and endemic corruption.

The president's running mate, Ma'ruf Amin, a 75-year old Muslim scholar, remained conspicuously quiet for much of the two-hour debate, spawning jokes among social media users.

Amin, who was brought in to shore up the president's Islamic credentials, was a controversial pick for Widodo's more moderate supporters because of his conservative stance on minority groups and rights issues.

Focus on economy

Prabowo and his running mate, businessperson Sandiaga Uno - both dressed in black suits and red ties - said they would take "drastic" action against corruption convicts, suggesting they could be isolated on a deserted island and given hard labour.

In 2017, Indonesia ranked 90 out of 176 countries in Transparency International's annual Corruption Perceptions Index.

Prabowo has attacked Widodo's management of Southeast Asia's biggest economy, zeroing in on flat growth and income inequality, and promising to boost job creation and investment.

Rights activist Andreas Harsono said neither ticket gave a comprehensive response to tackling abuses or the persecution of minorities such as the LGBT community or the Islamic Ahmadiyah sect.

Prabowo, a former special forces commander, has been accused of abuses, in particular of kidnapping and torturing student activists during the social unrest in 1998 that brought down former authoritarian leader Suharto.

His campaign team has denied the allegations, saying Prabowo did not mastermind the kidnappings but was acting with a team of soldiers on superiors' orders.

The next debate is scheduled for February 17.