Two weeks after the vote, the election still isn’t over in North Carolina.

Gov. Pat McCrory, a Republican, formally requested a recount Tuesday after filing more than 50 challenges alleging voter fraud as the latest tally showed him trailing his Democratic rival, Attorney General Roy Cooper, by anywhere from 7,000 to 9,000 votes.

A recount would go into effect if the candidates are separated by fewer than 10,000 votes after all ballots are tabulated in a race with nearly 4.7 million votes cast.

While Democrats have pressured Mr. McCrory to concede, saying he has little chance of making up the deficit, the governor’s campaign has countered with examples of voter fraud, including ballots cast by dead people, ineligible felons and those also voting in other states.

“With many outstanding votes yet to be counted for the first time, legal challenges, ballot protests and voter-fraud allegations, we must keep open the ability to allow the established recount process to ensure every legal vote is counted properly,” McCrory campaign manager Russell Peck said in a statement.

About 100 protesters gathered Tuesday night outside the governor’s mansion singing and waving signs with messages such as “Hit the Road Pat,” as shown in video posted by The Charlotte Observer.

“This is nothing but a last-ditch effort from Governor McCrory to delay and deny the results of this election,” Cooper campaign manager Trey Nix said in a statement. “Roy Cooper leads by 8,569 votes — a number that is growing daily as counties finalize election results. We are confident that a recount will do nothing to change the fact that Roy Cooper won this election.”

The State Board of Elections tally Wednesday showed Mr. Cooper ahead by about 7,600 votes, the official total reported by counties, although the campaigns have staffers on the ground updating the numbers before they become official.

The McCrory camp, which has filed protests in 52 of 100 counties, has swung back by accusing Mr. Cooper of trying to short-circuit the democratic process.

“Why is Roy Cooper so insistent on circumventing the electoral process and counting the votes of dead people and felons?” McCrory campaign spokesman Ricky Diaz said in a post. “It may be because he needs those fraudulent votes to count in order to win. Instead of insulting North Carolina voters, we intend to let the process work as it should to ensure that every legal vote is counted properly.”

Mr. McCrory trails in what was otherwise a strong election cycle for North Carolina Republicans, who maintained their congressional and legislative majorities and returned Sen. Richard Burr to Capitol Hill.

The governor was targeted by gay rights groups in March after signing HB2, a bill preventing localities from opening public facilities such as bathrooms and showers to members of the opposite sex in the name of transgender equality.

Thousands of absentee and provisional ballots have not been counted, and only 20 of the state’s 100 counties had finalized their official numbers as of Monday.

Democrats point out that Mr. Cooper’s margin has increased since Election Day, when he led by about 5,000 votes, and that a number of complaints have been dismissed.

Board members heard arguments from both sides Tuesday on whether the number of protested ballots would affect the outcome of the race and instructed county officials to keep all disputed ballots.

“They did tell the counties, go ahead, continue your canvasses, and do not pull any votes or do not discard any of these votes that have been challenged,” said board spokesman Patrick Gannon.

For Democrats, the worst-case scenario would be for the election to wind up in the Republican-dominated General Assembly. A state law allows a joint ballot of both chambers to determine the outcome of a “contested election.”

Election law analyst Rick Hasen, a professor at the University of California-Irvine, said North Carolina likely will face a legal challenge in federal court if legislators side with Mr. McCrory.

“If there is clear evidence both that Roy Cooper got more votes in North Carolina, with no plausible basis to claim that fraud infected the result (and by all indications so far, both of these facts are true), it could well be both a Due Process and Equal Protection Clause violation for the North Carolina legislature on a partisan basis to consider a ‘contest’ and overturn the results and hand them to Pat McCrory,” Mr. Hasen said on his Election Law blog.