Courtney Lee had just received the pass from Carmelo Anthony and was prepared to take a tying three-pointer, but out of the corner of the eye, he saw someone near him with his hand up, screaming that he was there to help.

Lee thought it was a defensive player, so he dribbled and drove and passed the ball to Brandon Jennings. But the person was Wizards assistant coach Sidney Lowe, who was on the court, and his presence affected Lee.

In the end, the Knicks didn’t get a shot off as John Wall slapped the ball away from Jennings. The Knicks lost to Washington, 113-110, on Thursday night at Madison Square Garden, but afterward, Lee and others in the Knicks’ locker room said the league should investigate that final play.

“I was watching Carmelo, thinking he’s about to shoot the ball, but then he drives and the ball comes to me,” Lee said. “Then I see [Kelly] Oubre in front of me, but right here I’m hearing, ‘I got your help, I’m right here, I’m right here!’ I come to find out it’s their coach standing next to me.

“I’m thinking he’s a player. So I drive and try to make a play. I don’t know if the league should look into that. If that was a tactic in their defensive scheme, it worked, because I thought it was a player.”

In the locker room, players were looking at reporters’ phones to see replays and screen shots that clearly showed Lowe was on the court and had his hand up.

advertisement | advertise on newsday

The Knicks (19-25) find inventive ways to lose games. This was a wild one because the Knicks came back from 14 down with 7 1⁄2 minutes left and went ahead 110-109 on Derrick Rose’s basket with 48.9 seconds left.

Anthony set a franchise record for points in a quarter with 25 in the second, when he helped turn a 13-point deficit into a one-point halftime lead. But Anthony got tired and went cold in the second half. He had 34 points but shot 2-for-12 and scored seven points after halftime. He also missed a go-ahead jumper with 18.9 seconds left.

Kristaps Porzingis returned after missing four games because of a sore left Achilles. An MRI revealed no structural damage, so he was cleared to play. He scored 15 points off the bench and helped spark the Knicks’ run in the fourth quarter, sprinting upcourt and throwing down Lee’s missed three-pointer.

But the bottom line was the Knicks couldn’t get the stops they needed, couldn’t score when they needed to and got distracted by the presence of an assistant coach.

Lee repeatedly said he should have taken the shot. Instead, he passed up on it, and the Knicks lost for the 12th time in 15 games.

“I’m frustrated that we lost,” Lee said. “I’m frustrated that I should have taken the shot. I’m frustrated that was even involved in the play.”

Wall had 29 points and 13 assists to lead the Wizards to their seventh win in eight games.

After Wall — who put the Wizards ahead 111-110 with two free throws with 32.6 seconds left — rebounded Anthony’s miss and blew past everyone for a fast-break dunk to make it a three-point game with 13.7 seconds left, the Knicks called timeout.

advertisement | advertise on newsday

Jeff Hornacek wanted the ball in Anthony’s hands, of course. He drove, and when the double-team came, he passed it to Lee in the left corner by the Wizards’ bench. “I’ll make that pass 10 out of 10 times to Courtney,” Anthony said.

Lee was open, but he flinched when he saw and heard Lowe, so he passed it to Jennings. He didn’t realize it was a coach until he saw replays.

“Their coach was like two feet away from me,” Lee said. “In my peripheral, I’m hearing, ‘I’m here, I’m here, I’m here!’ I’m thinking he’s a player. So I drive the ball.’’

“He was on the court,” Anthony said. “They had six players on the court.”

Kyle O’Quinn said, “At any level, you can’t do that. You look at the screen shots and it looks like he’s getting closer and closer to the paint almost. But it happens. Things didn’t go our way. But I’m sure the NBA will talk to him, get at him and do what’s right.”

advertisement | advertise on newsday

Lee said he was told by a Knicks assistant that next time he should run into the coach because it’s an automatic technical foul if he’s on the court. But Lee, in his ninth season, said he never experienced anything like that before. Anthony, in his 14th, said the same.

“I’ll make sure to glance over there and see if it’s a coach and do it next time,” Lee said. “I thought it was another guy rotating down. He fooled me. I still should have took the shot.”