It’s hard to know for sure if Boris Johnson actively wants to get sacked – but he’s doing a pretty good impersonation of a man who does.

The foreign secretary’s latest offence was to tell a fringe meeting at the Conservative party conference that the Libyan city of Sirte could prosper, eventually becoming the next Dubai: “The only thing they have got to do is clear the dead bodies away,” he said, in that tone he reserves for a comic aside. Naturally, the remark elicited laughter. And so, once again, the morning news shows were talking about Johnson rather than the prime minister – even on the day of her big speech.

Of course, this follows previous and more deliberate moves by Johnson to ensure all eyes are on him. In the last few weeks, we have been treated to his 4,200-word Brexit manifesto in the Telegraph, now functioning as an unashamed Johnson fanzine – its front-page report on his (rather middling) address to the conference came with a splash headline spanning all six columns hailing “the roaring lion” – as well as fully briefed reports of his “red lines” on Britain’s EU departure.

One colleague compares him to a jealous toddler trying to win back the gaze of the adults looking at his newborn brother

Both those interventions looked like Johnson laying down the law to Theresa May – and therefore, according to the usual rules of the Westminster jungle, sacking offences. But his joke about the corpses of Sirte, described by Tory MP Sarah Wollaston as “crass, poorly judged and grossly insensitive”, offers much more straightforward grounds for dismissal.

It touches directly on his ability to do his job. Indeed, it proves he cannot do it. Johnson is meant to be Britain’s chief diplomat, and this episode confirms that he lacks the human sensitivity that is a requirement of diplomacy.

Play Video 0:21 Boris Johnson: Sirte needs to ‘clear dead bodies away’ – audio

The very act of appointing a man involved in one of the most public, demonstrable and egregious lies of recent times – the bogus claim that Britain pays £350m a week to the EU – as foreign secretary was already an insult to the rest of the world. But retaining someone who clearly cares so little for the pain of others is untenable. Recall that just a few days ago, video emerged showing the UK ambassador to Myanmar having firmly to silence his boss, as Johnson mooched around a Buddhist temple, muttering to himself Rudyard Kipling’s colonial-era ode The Road to Mandalay – a verse bound to reawaken old hurts.

Still, all the signals suggest that Johnson will stay in his post. May is too weak to remove him. She dare not risking exiling him to the backbenches, where he will play the Brexit martyr and become the focus of Europhobic dissent.

Not that May is the real target of Johnson’s recent antics. No, the Telegraph essay and the red lines were designed less to undermine the PM than to stop a different rival in his tracks. The rival in question is Jacob Rees-Mogg.

Johnson has clocked the absurd Moggmentum cult, watching as the Somerset MP has stepped into the niche that used to be his alone – that of conference darling, heroically sticking it to Brussels while other Tories tremble. Why, Mogg even offers the same shtick: Etonian accent, Latin tags, supposedly lovable Wodehousian eccentricity, sub-Churchillian evocation of the glorious past of this island race.

The foreign secretary could not let his brand be grabbed by a competitor. So he’s been busy reasserting his claim on the hard Brexiter slice of the Tory market – decisive terrain, especially among the party members who will elect May’s successor. It’s almost been poignant to watch as Johnson waves his arms, seeking again the attention of the Tories who once adored him but have this week been queueing around the block to see Mogg. One colleague compares the Johnson display to a jealous toddler desperately doing somersaults, trying to win back the gaze of the adults now looking lovingly at his newborn brother.

Conservative conference 2017: Theresa May delivers keynote address - Politics live Read more

The trouble is, the old tricks don’t suit the job he’s got or the job he wants. His speech on Tuesday was a case in point. All politicians like to make the odd joke, but Johnson feels the need to keep them coming. (Surely that explains the Sirte gaffe: he just can’t pass up an easy laugh line.) The result is a kind of contamination effect. The gags don’t remain isolated but infect the rest until the whole speech becomes a joke. Even the serious bits sound like padding, the filler between punchlines.

This is Johnson’s problem. He needs to show gravitas as foreign secretary and gravitas to be prime minister. But he seems temperamentally unable to do it for long. He keeps reverting to type, lapsing into the familiar routine. And that routine is getting old.

• Jonathan Freedland is a Guardian columnist