A legendary San Diego surfer turned into a menacing diva after signing on as a celebrity partner in a popular Hamptons-based surf-gear company, a new federal lawsuit charges.

Former world-champion longboard king Joel Tudor teamed with Manhattan photographer and entrepreneur Andrew Blauschild in 2008 to launch Kookbox, a high-end surfboard and wetsuit company that quickly gained fans from Montauk to Sydney.

Andrew BlauschildPhoto: Patrick McMullan

But Blauschild claims that Tudor — one of the world’s best-known surfers — became increasingly arrogant over the years and started treating him and other staffers like serfs.

“Joel is one of the best-known surfers in history,” Blauschild told The Post. “But he has some issues.”

Blauschild says Tudor, 37, demanded to use company funds for a separate surfing venture he wanted to get off the ground.

“When those funds were not immediately provided, Tudor became irate,” the suit states.

After referring to himself as “the boss” and ripping Blauschild and other staffers as “liars and thieves,” Tudor walked into a Kookbox warehouse in San Diego in May and began “yelling and physically threatening’’ a manager, the suit states.

The enraged surfer then got on the phone with his partner in New York and said he was firing him despite their contractual 50-50 split, according to the suit.

A few days later, Tudor got a key to a warehouse and vandalized it before making off with surfing gear, the suit states.

Blauschild claims his former pal then used his surf-world celebrity to launch a slanderous campaign to cripple Kookbox permanently.

He told vendors that the company was kaput and that they should deal only with him in the future, the suit states.

But a source close to Tudor said that he had the idea for Kookbox long before he knew Blauschild and that they simply had creative differences that led to a split.

“I can’t believe he is suing Joel,” the source said. “They had agreed to just part ways and move on.”

Blauschild’s suit is seeking to have Tudor officially booted from the company and is demanding unspecified damages for slander and other misdeeds.

Tudor, a California native known for his cocky manner, is considered the worldwide king of longboard surfing and is credited with singlehandedly revitalizing the old-school style during the 1990s.