Phil Greene IV’s NBA dream remains alive.

Despite not getting drafted on Thursday night, the former St. John’s guard will get a chance in the NBA Summer League with the Raptors, his agent, Keith Kreiter, told The Post.

The 6-foot-2 Greene worked out for eight teams — including the Raptors — leading up to the draft and was hopeful of being a late second-round selection like fellow Johnnie Sir’Dominic Pointer (53rd overall to the Cavaliers). Instead, he went undrafted. By early Friday morning, however, Greene had agreed to play with the Raptors summer league team.

Last year, former St. John’s player JaKarr Sampson went undrafted, but he performed well in the Summer League with Philadelphia and spent the majority of last season with the 76ers.

An NBA scout who has followed Greene’s St. John’s career said he has a shot at the league, but will likely have to start in the D-League, before moving his way up.

Greene, a Chicago native, averaged 13 points per game last year and shot 39 percent from 3-point range, helping the Red Storm reach the NCAA Tournament for the first time in four years. Greene began his career as the St. John’s point guard, before moving off the ball the last two years, with the addition of Rysheed Jordan. At the next level, he will have to be a point guard.

“If he goes to the D-League, maybe he gets with the right team,” the NBA scout said. “I wouldn’t be surprised after a year or two if he is a call-up guy. He can manage a game real well.”