PHILADELPHIA — When the Knicks close their eyes at night, do they have nightmares of Franklin the Dog, the 76ers’ blue-furred mascot? Do they shudder when they see a cheesesteak? Because for a team that entered Friday night’s game preaching the importance of playing as if they still have a shot at the playoffs, the truth is that their greatest foil is none other than the 76ers.

In Part 3 of a particularly frustrating trilogy, the Knicks floundered and eventually fell, losing to the 76ers in the final moments, 105-102, at Wells Fargo Center. The 76ers (23-38) can credit two of their wins to the Knicks, and they would have had a third one if not for Carmelo Anthony’s last-second heroics a week ago.

Anthony tried to save them again. With the 76ers up by one, Anthony, who was triple- teamed, attempted a jumper in the lane that rimmed out with six seconds left and Lance Thomas missed the putback. Kristaps Porzingis fouled Dario Saric with three seconds left and Saric made both free throws to put the 76ers up by three.

The Knicks (25-37) had a chance to tie, but Lee’s three-pointer with one second left was no good.

“It hurts,” Anthony said. “We should’ve won . . . It was just one of those days. Derrick [Rose] missed a point-blank layup and down three, for us to get a look that Courtney got . . . I think my last two shots [went] in and out.”

And just like that, the Knicks, who came into the day talking about their faint playoff hopes, ended the night with their chances even more remote. The Bucks, one of the four teams ahead of them for the final playoff spot in the Eastern Conference, won, and the Knicks have to face Golden State tomorrow.

advertisement | advertise on newsday

“Time is running out . . . This season is running out,” Lee said. “That should wake us up . . . Games like this, this is one of those games you have to win.”

Thomas scored 21 points and Rose, who had a particularly ugly fourth quarter, finished with 20. Anthony, who shot 5-for-18, and Porzingis had 18 each and Lee finished with 16. Saric scored 21 and Justin Anderson had 19 for the 76ers, whose bench outscored the Knicks’ reserves 40-9.

Rose hit two free throws with a minute left to give the Knicks a two-point lead, but he missed two layups after that, including one with 17.8 seconds left.

“I missed a wide-open layup,” Rose said of the shot, in which he drove through a lane that was starting to clog. For the second time in a minute, his attempt didn’t even reach the basket.

“That’s why we lost tonight,” he said. “I put this game on myself. No excuses. I can take the blame. I’m used to having the ball in my hand in those possessions.”

The Knicks led by 11 in the first quarter but trailed by 10 at halftime. It was the third time in three games against the 76ers that the Knicks squandered a double-digit lead, though this time it happened early, as opposed to the fourth-quarter meltdowns in their first two meetings. Down by five with 4:20 left in the second quarter, the 76ers took off on a 16-1 run, good for the 63-53 lead at the half.

The 76ers outrebounded the Knicks 24-16 in the first half and held Anthony, Porzingis and Rose to a total of 21 points. Anthony was 3-for-9 from the floor.

“I think we try to go out there and we play, we play the same way throughout the course of the game and then teams make adjustments,” Anthony said. “We’re still playing the same way while other teams make those adjustments defensively. We still try to find our way.”