Republicans are headed to a primary fight to take on Sen. Hillary Rodham Clinton, after candidate Katherine “KT” McFarland staged a surprise late surge against party favorite John Spencer at the GOP convention yesterday.

McFarland snared nearly 37 percent of the weighted vote against Spencer, who took just over 63 percent. Her stronger-than-expected showing was engineered by gubernatorial hopeful John Faso, who convinced party members that it would be good to have two primaries, party insiders said.

Faso, a former Assembly minority leader, remained locked in a tight race with former Massachusetts Gov. William Weld among delegates, who will cast ballots today for the party’s pick for governor.

There had been a secret sitdown between Gov. Pataki, Senate Majority Leader Joe Bruno and powerful Nassau County GOP leader Joe Mondello to try to avert a primary.

In sharp contrast to the Democratic nominating convention going on in Buffalo, the mood was grim at the daylong GOP convention at Hofstra University. Party leaders like Bruno and Mondello urged unity and said the Democrats were the enemy – but privately, Republicans talked about their slim chances in November.

“The Republican Party must unite,” Spencer said after he was named the party’s designee with more than 50 percent of the vote, and he called on McFarland to drop out and focus on defeating Clinton.

But McFarland said she wasn’t running “some token campaign destined to fail” and insisted Spencer should bow out if unity was so important to him.

Bruno – who urged people to unite behind Spencer – and Pataki reached out to some McFarland supporters before the vote, insiders said.