The NBA All-Star Game could be coming to New York. Twice. In a three-year period.

Multiple league sources maintain that the 2015 All-Star Game will be played at Madison Square Garden on Sunday of All-Star weekend with the Friday and Saturday night events – the skills, shooting and dunk competitions – set for Barclays Center.

The league and both the Nets and Knicks still are negotiating on a proposal to have a reversal in either 2017 or 2018 — Brooklyn would stage the game while the Knicks and the Garden would serve as host for the Friday and Saturday events. The Nets, sources said, are not completely sold on the host role down the road for a myriad of reasons.

“It’s a possibility,” one league source confirmed of the 2017 or ’18 event plan but cautioned that “nothing has been finalized. They (Nets) aren’t certain (they want it).”

There are so many other factors to consider another source stressed, noting that by 2017-18 both the Garden and Barclays Center would be the home for hockey teams as well.

On a plus side, keeping the event in the city would be financially attractive for the NBA, which routinely rolls into the All-Star host city and spends a king’s ransom on hotels and communications for league staff.

Both the Knicks and the Nets have lobbied for the 2015 All-Star Game which would be billed as a New York City event, sharing arenas in Brooklyn and Manhattan. The last All-Star Game in York was 1998 at the Garden.

Recently, NBA deputy commissioner Adam Silver told The Post, “There is a process in that the (Knicks and Nets) are working together…On a business level, the teams get along very well…the nature of the sport is that the teams are highly competitive and you want them to be but they both recognize that they’re partners in the league and this is something that is positive for both teams.”

Additional reporting by Tim Bontemps