The dispute started last summer, when Unsworth criticized Musk in a television interview for involving himself in efforts to save a Thai soccer team that was trapped in a flooded and complex cave system.

In a court deposition released on Monday, Tesla and SpaceX CEO Elon Musk says he once worried that British cave diver Vernon Unsworth might be "another Jeffrey Epstein." The deposition came out as Musk and his lawyers asked a judge to dismiss the defamation case Unsworth brought against Musk for previous comments calling him a "pedo guy."

Reacting to that, Musk called Unsworth "sus" (suspicious) and a "pedo guy" on Twitter, and later characterized the spelunker as a "child rapist" in an e-mail to a Buzzfeed reporter.

In Monday's filings of the Aug. 22 testimony, Musk reveals that his representatives launched an investigation into Unsworth, and Musk was concerned with what the investigator found.

Specifically, Musk testified that he sent e-mails to Buzzfeed due to a concern over what he heard about Unsworth. He said, in the deposition:

"And I was like, well, what if this is a real situation? What if what we have here is another Jeffrey Epstein. We should, you know -- I have this -- I am told this information. I don't know if it is true. But what if we have another Jeffrey Epstein on our hands? And what if he uses whatever celebrity he gains from this cave rescue to shield his bad deeds? This would be terrible."

In the deposition, Musk also said he now believes that the private investigator led him astray, and was "just taking us for a ride."

The filings also revealed that:

Musk "mobilized" more than 50 top engineers from three of his companies to assist in the Thai cave rescue effort including Tesla, SpaceX and The Boring Company.

After Unsworth criticized the CEO, his family office run by President Jared Birchall, hired a private investigator to learn everything they could about the cave rescuer and his family.

The private investigator they hired, James Howard of Jupiter Military and Tactical Systems, told Musk's family office (Excession LLC) that Unsworth was said to spend time at a beach known for child sex-trafficking, among other unsavory but inconclusive details.

Unsworth, in a deposition, denied he had spent time at those venues.

A person who works for Musk's office, James Brickhouse, suggested that the investigator pose as a journalist to interview Unsworth as one method for attaining personal details about him.

One of Musk's key arguments to the court is that he first said "pedo guy" as a generic insult, and didn't mean to "convey facts," with his tweets.

At the time Elon Musk was first clashing with Unsworth, he had also said he was considering taking Tesla private at $420 a share, and had funding secured.



Follow @CNBCtech on Twitter for the latest tech industry news.