After a terrific first half, the Knicks were primed to pounce to within two games of the Hawks, losers earlier in the day, in the desperate chase for the eighth and final playoff spot in the East. But then the Knicks suffered a devastating setback.

They had to play the second half.

And they started doing so resembling the ensemble cast of “The Walking Dead.” Still, it should not have been such a horrid assignment. The Cavaliers were without All-Star Game MVP Kyrie Irving and this game meant so much to the Knicks who were riding an eight-game winning streak.

Well, the winning streak ended Sunday. So, too, may have any real hope of the playoffs.

“It is definitely an opportunity lost,” said Tyson Chandler.

Opportunity and the game were lost as Irving’s understudy, 31-point scorer Jarrett Jack, penetrated and pick-and-rolled the Knicks into a bitter 106-100 defeat, the first loss since Phil Jackson became team president, and a numbing send-off for a five-game Western Conference trip.

“I thought we came out a little flat [after halftime],” said Carmelo Anthony, who scored 32 points — but he shot just 2-of-10 in the second half. “[Cleveland] never quit, we had a chance to put them away and take the lead from 15, 16 to maybe 20-something points, but we didn’t and it was a turnaround for them.”

And a kick in the butt for the Knicks, who remained three games behind the Hawks, four in the loss column, with 12 games to play, seven of those in April against playoff-bound teams. The Knicks shot 71.4 percent in the first quarter, led by 17 in the second, 15 at the half.

And lost.

“We should’ve won this game. We gave it away. They earned it. They beat us,” Anthony said. “We didn’t play well coming down the stretch in the second half and they did.”

While the Knicks (29-41 — well, there goes the winning record) simply let the Cavs (27-44) hang around too long, their offense went stagnant in the fourth quarter when they were outscored 29-16. “Went stagnant” is being nice. It disappeared. And the defense wasn’t too hot. Jack alone scored 13 for the Cavs.

“Jack got hot coming off that screen and roll,” said Raymond Felton (14 points). “Once a guy gets it going like that, it’s kind of hard to guard.”

The crushing basket came 24.7 seconds from the end when Jack, with the Cavs up two, worked against Felton. Jack drove, stopped and hit from 10 feet for a 104-100 lead. On the Knicks next possession, Anthony was called for an offensive foul.

Game. Set. Match. Playoffs?

“It’s tough. It’s very tough. We could move to within two games after tonight had we taken care of business,” said coach Mike Woodson, who saw the abysmal transformation in the second half and called a timeout just 44 seconds, and five Cavs points, into the third quarter. “We didn’t handle our business and I’ve got to take full responsibility.”

Hey, more than one body should be hurled under the bus. Offensively, the Knicks shot 31.6 percent after halftime and the Cavs shot — ready? — 76.7 percent. Dion Waters added 22 for the Cavs.

“They were just scrapping more,” said J.R. Smith (18 points). “We just let them set the tempo instead of setting it in the third quarter.”

Even knowing that the Hawks lost? How is that possible?

“That’s a huge opportunity lost, one we can’t afford. But we can’t get it back. Just got to go out there on the road and win some games,” Smith said. “Hopefully they keep losing.”

But the Knicks have to keep winning.

“It’s behind us now, nothing we can do about that. We got the Lakers coming up [Tuesday], a big road trip ahead of us,” Anthony said, “and we’re looking forward to that.”