PHILADELPHIA — Derrick Rose showed up, shined and still couldn’t prevent the Knicks from losing a buzzer-beating heartbreaker.

T.J. McConnell scored on a spinning, off-balance 10-footer after faking out Carmelo Anthony as the Sixers stole a 98-97 victory Wednesday at Wells Fargo Center, setting off a wild celebration after the Knicks blew a 13-point fourth-quarter lead and a 10-point bulge in the final 2:30.

“Definitely embarrassing the way we’re losing games,’’ guard Courtney Lee said. “There’s no excuses. It’s just us. This s–t is definitely embarrassing. We have to find consistency in everything — soon.

“It’s got to be defense first. We got to change our mentality.”

Rose had a blazing start and a magnificent finish, scoring three huge baskets in the final three minutes, including a lovely reverse lefty layup with 32 seconds left.

He finished with 25 points on 11-of-16 shooting with four assists, but it was wasted with the late collapse.

Anthony scored 28 points, though he was held scoreless in the final period and Kristaps Porzingis shot an airball with seven seconds left to set up the winning scramble bucket by the Sixers.

“Very, very disappointing, giving ourselves a chance to win on the road and to come up short,’’ Anthony said. “We got to learn from this and let it slip away. … We should tell ourselves it’s unacceptable.’’

Rose’s strong outing came two days after he went AWOL and left the Knicks for dead against the Pelicans. And now they have suffered yet another awful defeat, falling to 17-22 — a season-worst five games under .500 with the Bulls coming up Thursday at the Garden.

With the Knicks up a point with 27 seconds left, Rose drove and kicked it out smartly to Brandon Jennings, who fed Porzingis. The Latvian airballed a corner 3 and the Sixers, in scramble mode, raced the ball upcourt with McConnell hitting the winner. It gave Philadelphia (11-25) its fourth victory in five games and sent the Knicks to 1-9 in their last 10.

“So much going on, I don’t have a recollection,’’ Anthony said of the final play. “I don’t want to give a wrong answer. I have to go back and look at the tape.’’

Knicks coach Jeff Hornacek said Porzingis has looked tired of late and blamed it on potential recurring Achilles woes.

“Tough way to lose,’’ Hornacek said.

“It is going to be a tough month for us and it already is starting to get tough and now it’s going to show if we can get out of this or not,’’ said Porzingis, who had a brutal performance with seven points on 3-of-10 shooting.

Rose hit a big stepback 19-footer with 2:52 left that put the Knicks back up by eight. Rose, with the shot-clock winding down, also fired in a 14-foot liner from the left side to drive the lead to six with 1:24 left.

Then came his big final burst to the hole for a reverse that appeared to win the game with 34.5 seconds left, giving the Knicks a three-point edge.

Rose made Hornacek proud again on the last possession, penetrating, getting doubled and kicking it out that led to an open shot.

“Drive, just an open look like we got,’’ Rose said. “We’re living and dying with whoever is on the team. If you’re open shoot the ball. It’s not on [Porzingis]. It’s on the entire team.’’

Hornacek said Rose made the perfect play on their ill-fated last possession.

“He drove, got picked up and found the open guy,’’ Hornacek said.

The Sixers shot just 38 percent and still won. Rose, whipping to the basket, hit six of his first seven buckets, pouring in 12 points and three assists in the first quarter as the Knicks rallied from a slow start to take a 32-27 lead after one and a 17-point lead in the second period.

With a bounce in his step, Rose was on getting to the basket against the Sixers’ injury-depleted point-guard alignment that had McConnell as starter and in the end the hero.

“I felt good, I only missed one day, one game,’’ Rose said. “I work too hard. I was just trying to come back and play how I normally know how to play.

“Just be Derrick.’’