Rory Stewart’s career in politics will be over if Boris Johnson manages to secure a British exit from Europe next month, he has told a festival crowd.

The former international development secretary, who was among the 21 Conservative MPs to have the whip withdrawn after rebelling against the government, said: “I would resign. It would be the end of my political project.” Speaking to a packed crowd at the HowTheLightGetsIn philosophy and music festival in London he added that he still regards the prime minister’s promise to deliver Brexit by 31 October as “somewhere between a fairy story and an untruth”.

Asked what he would do if he were proved wrong, he said: “If he does get a deal through, I would not stand again. I would be the first to apologise. I would get down on bended knees in front of Boris and admit I’d been wrong.

“At some level what I am going through is the experience of losing my job or being kicked out of a marriage, and that does have an effect on you,” he said. “It is hard to see people you thought were your friends in parliament on television saying that it was right that I got fired.”

Johnson, he believes, will try to continue to lead even if the supreme court rules against the validity of his decision to prorogue parliament. “The danger is then we would move to a more Trumpian form of politics where he would claim to represent the people against parliament.”

Stewart delivered his powerful verdicts on the current political crisis during a heavily oversubscribed public interview at the festival. Speaking to the BBC journalist Emma Barnett, he accused David Cameron of being guilty of “an astonishing betrayal of trust” if his recent accounts of his discussions with the Queen on the eve of the EU referendum are correct. Stewart said Cameron was also partly to blame for a general “collapse of seriousness” in politics and in public life. Admitting he had not yet read Cameron’s new memoir, Stewart said he believed the former prime minister was too fond of political gossip. “I am afraid he likes insider gossip. He thinks it is a good way to charm the crowd.”

As a former leadership candidate himself, Stewart attacked the character and political strategies of both Cameron and Johnson, fellow old Etonians. It was not right, Stewart argued, for the public to blame advisers such as Dominic Cummings for government strategy. “I take the simple view that the person responsible is the person at the top,” he said.