John McDonnell, the shadow chancellor, has said it discredits Labour to share a platform with Tories arguing to stay in the EU – the day after the London mayor, Sadiq Khan, appeared on stage with David Cameron.

McDonnell said it reflected badly on the party and would demotivate its supporters to see senior figures on a stage with their political opponents.

The remarks appear to refer to Khan, who won the London mayoral contest last month and decided to appear on a platform with Cameron on Monday.

A spokesman for Khan said the mayor would not waste any chance to make Labour’s pro-EU position clear, especially in light of polling that shows voters are not sure where the party stands.

“It should come as no surprise that Sadiq is campaigning with the prime minister for Britain to remain in the EU, as he made it crystal clear that he would do so throughout the mayoral election,” he said.

“It is deeply concerning that the polls today suggest that Labour voters are unsure where the Labour party stands on the referendum. Sadiq won’t miss a single opportunity to make it absolutely clear to those voters where Labour stands on the referendum.”

A spokesman for McDonnell said: “John’s comments were not specifically addressed towards Sadiq. He was only repeating what he and other members of the shadow cabinet have said before on learning the lessons from the referendum in Scotland and campaigning on a distinct Labour message. And if anything the polling out today suggests adopting such an approach can only be helpful to achieving a Labour vote to remain on 23 June. That is why John will continue fighting hard for every vote to keep Britain in the EU and prevent a Tory Brexit.”

Despite a Tory campaign that sought to paint Khan as someone with links to Islamist extremists, the new mayor said at the weekend that it was in London’s interests to put aside party differences and work with Cameron on the issue.

“Is it in London’s interests for me to hold grudges? Is it in London’s interests for the mayor of London to be at permanent war with the Conservative prime minister?” he asked.

“There are many areas on which the prime minister and I disagree, we’re never going to be best friends, but what’s important is for the mayor of London to argue the case for London and for Londoners to remain in the European Union,” he said over the weekend.

“I’m willing to put aside our differences, put aside the grudges that he or I may have because this argument, this debate, is far more important than David Cameron or me. It’s about our city’s future, our country’s future. It’s about the patriotic, positive case for us to remain in the EU.”

McDonnell, however, made it clear he thought that no Labour politicians should be on stage with Conservatives, as he gave a question and answer session on the EU in Wolverhampton.

“The Europe that the Tories want is not our Europe. Cameron went to negotiate away workers’ rights in advance of this referendum. If he could have done it, he would have done,” he said.

“If Cameron and his crew are still in power after this referendum they will continue dismantling our welfare state. They will continue to cut benefits, undermine wages and cut public service jobs. This will go on.

“Sharing a platform with them discredits us. It demotivates the very people we are trying to mobilise.”

Jeremy Corbyn, the Labour leader, has also ruled out appearing on stage with Cameron during television debates or events.

