Carmelo Anthony #7 of the New York Knicks drives to...

Carmelo Anthony #7 of the New York Knicks drives to the hoop in the second quarter against Richard Jefferson #24 of the Cleveland Cavaliers at Madison Square Garden on Saturday, Feb. 4, 2017 in New York City. Credit: Jim McIsaac

LeBron James is the main attraction whenever he visits the Garden, and he didn’t disappoint with another brilliant performance Saturday night. His buddy Carmelo Anthony had plenty of eyes on him too, but he disappointed the home crowd and maybe his bosses.

As rumors persist about an Anthony-for-Kevin Love swap, Love played like an All-Star and might have sent a message to the Cavaliers that they would be foolish to move him. Anthony had a rough night, heard more groans from the fans and sounded as if he’s weary of the losing and everything swirling around him.

The Knicks cut a 27-point third-quarter deficit to five in the game’s final minute before James and Love sealed the Cavaliers’ 111-104 victory. After the Knicks’ 17th loss in 23 games and all the off-court drama he’s dealt with, Anthony, who has a no-trade clause in his contract, said it’s hard to stay Melo.

“It definitely kind of tests you, can put you to the test,” he said. “You have to dig deep within yourself to get through it on a day-to-day basis, figure out a way to still go out there and play at a high level every night, play hard, lead this team. That’s kind of where you have to dig deep despite everything that’s going on, that’s surrounding — I don’t even want to say us, me — it’s testing me. It’s testing my will. It’s testing me as a human being. It also is making me stronger throughout this process.”

James finished with 32 points, 10 assists and five rebounds to lead the Cavaliers, who were without Kyrie Irving because of right quadriceps soreness. Love had 23 points and 16 rebounds.

Knicks president Phil Jackson, who was sitting with general manager Steve Mills, couldn’t have liked what he saw from Anthony or the rest of his team for most of the night, especially when they fell behind 84-57.

When Anthony stripped James and went in for a dunk, the Knicks drew within 106-101, but James drove the lane and threw a brilliant hook pass over his head to Love for a corner three-pointer that made it an eight-point game. After another miss by Anthony, James threw down an emphatic slam with 30.6 seconds left to make it 111-101.

Anthony scored 17 points but shot 6-for-20 from the field. He hurt his shoulder early in the game and said it could have contributed to his poor shooting night. But for the second straight game, the Knicks (22-30) played best when Anthony was on the bench.

When they began their fourth-quarter rally, he was sitting with a towel draped over his head. In Wednesday night’s comeback win over the Nets, he was a spectator for the entire fourth quarter.

Brandon Jennings scored 17 of his 23 points in a span of 3:20 between the third and fourth quarters, hitting five three-pointers in that stretch. He had 10 assists and shot 8-for-13 from the field, including 6-for-8 from three-point range. Willy Hernangomez had 16 and Courtney Lee 14. The Knicks were without Derrick Rose (sprained ankle) for the fourth straight game.

Kristaps Porzingis (nine points, eight rebounds) shot 3- for-10 and missed two free throws with four minutes left.

Anthony, however, continues to be the only Knick to have boos directed at him. They started late in the first half when he held the ball to take a last shot. After he was fouled, he waved his finger at the crowd. “The fans are the fans,” he said. “It’s been happening as of late.”

He said it’s gotten louder since the trade talk started. “You are what the back page says you are,” he said. “Fans read that. And they react to that. I got to get in the gym. I’ve got to get in the gym tomorrow and work on my shot, and they won’t boo me.”

Said Jennings, “It seems like they’ve been booing a lot since January 1st because we’ve been playing so poorly. It’s all of us. It’s not just one person. We all have to take accountability for what we do on the court.”