It’s legal to yell at someone over the phone — but you better not threaten them!

That’s the message Manhattan federal Judge Kevin Castel had for reputed wiseguy Anthony Bazzini Tuesday as he sentenced him to a year and a day behind bars.

“The important point here today is it’s not against the law to lose your temper and get angry — even if you’re a New Yorker,” Castel said.

But Castel added that “threatening someone with bodily harm” is a “crime” — and to think otherwise shows “a lack of respect for the legal system.”

Bazzini was one of 32 people busted by the feds in January 2013 for being part of a massive gangland effort to control the New York-New Jersey garbage carting industry. He previously pled guilty to interfering with commerce by threatening bodily harm on a confidential government witness between 2011 and 2012.

In addition to the jail time, Castel hit him with a $3,000 fine and he faces three years of supervised release when his prison sentence ends.

The 54-year-old from Glen Head, LI — who bizarrely tried in court filings to previously distance himself from comparisons to fictional mob boss Tony Soprano played by the late James Gandolfini— had claimed he was provoked into threatening the witness over a phone call.

His lawyer, Raymond Perini, in seeking a non-prison sentence of probation for Bazzini, said the wire-wearing witness went out way to “push [Bazzini’s] buttons” while beating him for thousands of dollars in business deals.

He claimed the witness was so desperate because he faces a minimum of 10 years in prison for a sex crime that he accidently recorded himself saying that getting Bazzini to threaten him “would be good” for his situation.

“This is New York, and when you [provoke] someone you get yelled at,” Perini said.

Assistant US Attorney Brian Blais responded, “Being a New Yorker is not an appropriate justification for threatening someone over the phone.”

He also said Bazzini has a history of making violent threats, including a 2003 federal extortion conviction related to Bazzini threatening “to cut off his stockbroker’s mother’s hands,” putting the broker’s “brother in four casts” and “killing” the broker’s whole family.

The threats were made after Bazzini suffered losses in the stock market.

The feds say Bazzini was the “ghost owner” of Galaxy Carting in Ronkonkoma, which also did business in New Jersey. They had sought 12 to 18 months in jail for Bazzini.

He and 31 other reputed mobsters were busted for allegedly scheming with rival Mafia families to trash efforts to clean up the garbage business — and using strong-arm tactics to shake down owners of legitimate companies and secretly assume control of their operations.