Carmelo Anthony in the second half of a game against...

Carmelo Anthony in the second half of a game against the New Orleans Pelicans at Madison Square Garden on Monday, Jan. 9, 2017. Credit: Jim McIsaac

The whole thing was off-key from the beginning, when that catchy, much-played song “Coming Home” became the promotional soundtrack of Carmelo Anthony’s arrival with the Knicks in February of 2011.

In fact, Melo left Brooklyn at age 8 and mostly grew up in Baltimore, so on the Baltimore-New York continuum of New York sports stars’ hometowns, he was much closer to Babe Ruth than Lou Gehrig.

Oops, sorry to bring up Gotham sports royalty. Anthony never was that in the 6½ years before he mercifully was sent packing in a trade to the Oklahoma City Thunder that will become official Monday and gives him a shot at late-career postseason glory.

Not only was Anthony not Ruth or Gehrig, he was not Derek Jeter or Eli Manning, nor was he Henrik Lundqvist, Darrelle Revis, Yoenis Cespedes or any other big-name, big-money, 21st century New York jock who managed at least a deep playoff run.

Melo was a dud, relative to the hype that surrounded his arrival and his career body of work.

Not that it wasn’t worth a try!

Anthony created buzz, initially alongside Amar’e Stoudemire, helped sell some expensive tickets to the renovated Madison Square Garden and once upon a time won 54 regular-season games and a playoff series.

He also was a mostly amiable fellow and stayed above the organizational fray even as former team president Phil Jackson publicly turned on him, and even as a supporting cast of mediocrity shuffled on and off the roster.

The biggest blot on his resume — other than the epic pile of losses — was his petulant non-embrace of the style that briefly worked wonders during the Jeremy Lin “Linsanity” period early in 2012.

It turns out there is another basketball path than Melo holding the ball while pondering his next isolation move. Who knew?

Whatever. That’s for the Thunder, especially Russell Westbrook and Paul George, to figure out now, somewhere in deep in the heart of Middle America, figuratively about as far from Midtown Manhattan as one can get.

Melo now is the third star in a mostly Triple-A city. Have fun with that!

The particulars are largely beside the point. The Knicks will get center Enes Kanter, guard Doug McDermott and the 2018 second-round draft pick the Thunder acquired from the Chicago Bulls.

So it does appear the Knicks will fulfill their contractual obligation to field a basketball team in 2017-18, starting Oct. 19 against . . . the Thunder in Oklahoma City, on national TV! Let’s just say TNT executives were pleased with the trade.

New York basketball fans presumably will pay some extra notice to what goes on in OKC in the coming season out of curiosity, but only to a point. And that in itself is part of the larger lesson here.

Anthony’s legacy in New York is neither beloved winner nor loathed villain. It’s . . . meh.

Leaving was a relief for all parties and a necessary step in the Knicks’ latest fumigation, which began with the ousting of Jackson, who like Anthony collected many millions of the Garden’s dollars as a souvenir.

This is Kristaps Porzingis’ team now, a guy with another complicated story when it comes to his relationship with the Garden.

Speaking of complicated relationships, Patrick Ewing had one with the public during his 1990s heyday, but even at the time sane fans understood that he would be missed when he was gone, which he certainly has been.

Anthony? Not so much.

When the Knicks someday win another championship and it is time for a retrospective on the dry decades that led up to it, Melo will be a footnote. He came. He tried. He failed.

Time to move on to the next thing, and get back to work.

Highlights with the Knicks

Feb. 21 , 2011: Anthony traded to the Knicks for Wilson Chandler, Raymond Felton, Danilo Gallinari, Timofey Mozgov, a 2014 first-round pick, and swap rights in 2016. The Knicks also received Chauncey Billups. Denver acquired Kosta Koufos from the Timberwolves.

April 2011: Averaged 29.8 points and named Eastern Conference Player of the Month, the first Knick to do so since Patrick Ewing in January, 1995.

April 19, 2011: Tied career playoff high with 42 points in Game 2 of first-round loss to Celtics.

April 17, 2012: Recorded first triple-double with Knicks (35 points, 12 rebounds, 10 assists) vs. Celtics.

Jan. 27, 2013: Tied Knicks single-game mark (since broken) with career-high nine three-point field goals made (42 pts.) vs. Atlanta.

April 2-5, 2013: Scored 40 or more points in three straight games, tying Benard King’s franchise record, set in 1984.

2013 Playoffs: Averaged 28.8 points per game, second to only Kevin Durant (30.8 with Thunder).

Dec 18, 2013: Logged career-high 55 minutes in two-overtime win over Bucks. He had 29 points and nine rebounds.

Jan. 2014: Named Eastern Conference Player of the Month after averaging 28.7 points.

Jan. 24, 2014: Scored 62 points, a Knicks single-game record in win over Bobcats. It broke Bernard King’s previous mark, 60, set on Dec. 25, 1984.

Jan 17, 2014: Recorded Knicks’ first 20-20 game (26 points, 20 rebounds) since David Lee in April 2010.

Feb 16, 2014: Scored 30 points in the All-Star game, including eight three-pointers, that set a since-broken single game All-Star record.

Nov. 2, 2014: Scored 20,000th career point vs. Charlotte.

Jan 29, 2017: Scored 45 points against Atlanta, a season-high.