Elon Musk will have to go to trial to defend himself for mocking a British diver and baselessly calling him a paedophile.

The verbal sparring match unfolded last summer after the underwater rescue of youth football players trapped in a Thailand cave.

A federal court judge in Los Angeles set a 22 October trial date on Friday in a filing that rejected the Tesla chief’s attempt to dismiss a defamation lawsuit filed by the British diver Vernon Unsworth.

Musk called Unsworth a “pedo” in a 15 July post on his Twitter account after the diver, in an interview with CNN, dismissed the tech multibillionaire’s attempts to help rescue the football players as a “PR stunt”. Unsworth also derided the submarine that Musk had built for a rescue mission. The comments prompted Musk to lash out at Unsworth via his Twitter account, which at the time had 22.5 million followers.

Musk contended his insult was protected from legal action, but the judge overseeing the case disagreed.

Unsworth is seeking more than $75,000 in damages from Musk. The suit also seeks a court order prohibiting Musk from making any further disparaging comments.

This is the second time in less than a year that Musk’s free-wheeling comments on Twitter have saddled him with legal headaches.

Last year, Musk and Tesla reached a $40m settlement of allegations that he misled investors with a tweet declaring he had secured financing for a buyout of the electric carmaker. He then had to go to court in April to defend himself against assertions that his tweets had violated an agreement with the Securities and Exchange Commission.