David Cameron was met with cries of “racist” in the House of Commons as he joined attacks on Labour’s London mayoral candidate after he claimed that Sadiq Khan had links to a supporter of Islamic State.

Cameron laid into Khan during prime minister’s questions, saying the Labour mayoral contender had nine times shared a platform with a radical imam called Suliman Gani, who he said supported ”IS” (Islamic State).

In the Commons, Cameron said he was “concerned about Labour’s candidate as mayor of London who has appeared again and again and again” on a stage with people he described as extremists.

After being interrupted by cries of “racist” by Labour MPs, Cameron continued: “The leader of the Labour party is saying it is disgraceful. Let me tell him, Suliman Gani – the honourable member for Tooting [Sadiq Khan] has appeared on a platform with him nine times. This man supports IS [Islamic State]. I think they are shouting down this point because they don’t want to hear the truth.”

However, Cameron’s claim came under pressure when Gani told LBC Radio that he backed the Tory candidate Dan Watkins last May against Khan in Tooting and even supplied canvassers for his campaign.

He added that, following the election, the Tories had asked him to help them find potential local councillors. He said felt he had been used by the Conservatives “as a scapegoat to discredit Sadiq Khan.”

Neil Coyle, a London Labour MP said: “The prime minister’s desperate dog-whistle has now totally backfired. “It now turns out that Suliman Gani campaigned for the Tories at the 2015 General Election, met Zac Goldsmith in November last year and campaigned against Sadiq Khan because of his support for same sex marriage.”

Cameron’s attack on Khan echoed those already made by Zac Goldsmith, the Conservative mayoral candidate, who has claimed his Muslim opponent would be soft on crime because he “provided cover for extremists”.

Labour campaign sources believe the Tories are increasing their attempts to associate Khan with extremism in a last-ditch attempt to turn around their candidate’s flagging performance in the polls.

Khan accused the Conservatives of running a “nasty, dog-whistling campaign that is designed to divide London’s communities” and said he was “disappointed that the prime minister has today joined in”.

Within minutes, Gani himself also rejected the claims, arguing he has always condemned Isis. He challenged Cameron to repeat his comments outside the chamber so he could sue for defamation.

Labour sources have pointed out that Gani has also shared a stage with Jane Ellison, the Conservative health minister and met Tory MP Tania Mathias.

The furore was provoked after a Conservative MP asked Cameron a planted question about condemning extremism, allowing the prime minister to say he was worried about Khan’s judgement.

Afterwards, Cameron’s official spokeswoman came under pressure to defend the prime minister’s claim that Gani supported Isis, when the man allegedly expressed support for “an Islamic State”, rather than the terror group.

Asked for Downing Street’s evidence that Gani supports Isis, she said that “at an event previously, he called for an Islamic State. IS. Islamic State.”

Pressed on whether that was the same thing, she said: “I think you can have a debate about what IS means. But as you’ve just pointed out IS stands for Islamic State.”

Asked for a third time whether the PM has evidence that Gani supports Isis, the spokeswoman said: “The point the PM was referring to was at events this individual has spoken up on a range of things including the formation of an Islamic state.”

Downing Street was also pressed about the wider tactics of the campaign attempting to link Khan to extremism, but a No 10 source strongly defended Cameron’s right to raise the issue. “The prime minister is calling into question the judgment of Sadiq Khan. That’s a perfectly legitimate thing to do,” he said.

Despite that, senior Labour figures believe the strategy is deliberate and Islamophobic. Former shadow business secretary Chuka Ummuna, the Labour MP for Streatham, said: “They would not be raising these questions if Sadiq was not a Muslim. If our mayoral candidate was a non-Muslim human rights lawyer, they would not be making any of these allegations at all.”

“Our own prime minister is basically saying to young Muslim boys and girls that if you wanted to stand for one of the most prominent elected positions in our country, you will face this outrageous prejudice from people holding the highest office in our country. It’s cynical, and it’s deliberate, and it’s desperate – because Zac is losing,” he said.

Deborah Mattinson, the founding director of strategy advice and research firm Britain Thinks, described the attacks as “desperate stuff and somewhat at odds with Zac’s languid style”.

She said the strategy was likely to be based on focus groups that showed the Conservatives what would work. “They will have tested it, and will know that it will help, perhaps with older, suburban voters. ”Sadiq should win with a massive majority, given the demographic of London and past performance. But differential turnout may make it very difficult for him to do more than scrape home.”

And when asked if he regretted sharing a platform with extremists, he said: “I regret giving the impression I subscribed to their views and I’ve been quite clear I find their views abhorrent.”

He has promised during the campaign to be a Muslim mayor who tackles extremism.

Goldsmith, MP for Richmond Park and North Kingston, has also hit back at the suggestion that he or his campaign team had labelled his Labour rival an “extremist” himself. He said: “My campaign has been overwhelmingly positive. I have made it very, very clear that I have never suggested that Sadiq Khan was an extremist in any way at all.

“The point I have made, and Londoners have made and the newspapers have made on a regular basis is that Sadiq Khan has given platforms and oxygen and even cover to people who are extremist and I think that is dangerous.”

He added that the claims made against Khan himself had been down to “only a few nutjobs on Twitter”.