A Potentially explosive confrontation over Gov. Cuomo’s tough new gun law was avoided over the weekend as 1199 SEIU, the hospital workers union, abruptly canceled a Thursday rally designed to challenge some 10,000 opponents of the governor’s measure, The Post has learned.

Weeks ago, the opponents announced that they would hold a rally Thursday. They said it would be one of the biggest protests ever at the state Capitol, with 10,000 or more in attendance.

But late last week, rally backers were startled to learn that 1199, which has strong ties to Cuomo, Mayor Bloomberg and the state Democratic Party, had joined with the Brady Campaign to Prevent Gun Violence to bus backers of the new law to a counter-rally.

“Join Us in Albany to Support Gov. Cuomo’s NY Safe Act to end gun violence,’’ the SEIU said on its Web site.

Assemblyman Bill Nojay (R-Rochester), who opposes the new gun law, said, “Rent-a-mobs to provoke a confrontation cannot have a good ending.’’

Brian Olesen, one of the state’s largest gun dealers, said many opponents of Cuomo’s measure viewed the SEIU rally as an attempt to provoke a confrontation.

Most of SEIU’s membership is black and Hispanic, while most of the opponents of the Cuomo law are white. Advocates on both sides of the issue were concerned that any confrontation would be seen as having racial overtones.

As word of the planned counter-rally spread, the Albany police and aides to Cuomo agreed there was the potential for a serious confrontation.

Late Saturday afternoon, 1199 removed any mention of the rally from its Web site, and knowledgeable insiders said the pro-gun law rally was canceled.

“This could have gotten really ugly, and it made sense just to have the rally in support of the governor’s law another time,’’ said a source close to the situation.