Tech billionaire Elon Musk sat quietly in court on Thursday as a judge warned him to “proceed cautiously” with his tweeting, which has drawn the ire of securities regulators.

“I don’t care if you’re a small potato or a big fish, if you’re under a court order you proceed cautiously,” Manhattan federal Judge Alison Nathan warned.

The judge made the rebuke during a court-ordered standoff between Musk, 47, and the Securities and Exchange Commission, which has asked the judge to hold the electric car company CEO in contempt of court over his tweets about Tesla.

“Tesla still appears unwilling to exercise any meaningful control over its CEO,” SEC lawyer Cheryl Crumpton told the judge Thursday. “He is regularly tweeting about communications that could be material and blowing past the approval process.”

But judge declined to spank Musk — choosing instead to order the Tesla CEO and the SEC to work their issues out privately.

“Take a deep breath, put your reasonableness pants on and work this out,” Nathan told Musk and the SEC’s lawyers at the end of a nearly two-hour hearing.

Musk left the courthouse laughing and grinning. Asked if he thought he could work out an agreement with the SEC over the next two weeks, he smirked and said “most likely.”

His dispute with the SEC first kicked off in August when Musk sent Tesla shares on a roller coaster ride by tweeting that he had “funding secured” to take Tesla private at $420 a share.

The SEC said the claim was fraudulent and noted that it appeared to be an attempt to impress his then-girlfriend, the pop singer Grimes, with a marijuana joke.

Under an October settlement agreement — which Nathan approved — Musk agreed to stop tweeting about Tesla’s business without a lawyer’s approval.

But on Feb. 19, he tweeted that Tesla expects to produce around 500,000 Model 3 electric vehicles in 2019 — only to update the tweet four hours later to explain that the 500,000 figure was actually an annualized production rate.

Making matters worse, his top lawyer announced his departure less than a day later — after only two months on the job.

That put Musk back in the SEC’s crosshairs, including accusations of a “stunning” disrespect for his agreement with it.

He, in turn, blasted the agency as “broken.” He has also accused it of violating his constitutional right to free speech.

Musk, in turn, blasted the agency as “broken.” He has also accused them of violating his Constitutional right to free speech.

The tech billionaire showed less bravado Thursday as he sat silently through the roughly two-hour hearing wasn’t required to show up for because it is a civil, not criminal, case.

He arrived anyway in a white Tesla, saying “I have great respect for the justice system. I think the judges in the American system are outstanding.”

Asked if he felt the same way about the SEC, Musk only chuckled before making his way inside.

He did, however, lavish praise on Judge Nathan, calling her “an outstanding representative of the judiciary system.”