A contentious special election in Upstate New York has quickly become a test run of sorts for 2012 as outside political groups pump more than $2 million into an obscure three-way House contest.

Republican and conservative groups, led by the Karl Rove-backed American Crossroads, have flooded the airwaves with ads attacking the Democratic and tea party candidates vying to replace former Republican congressman Chris Lee. Democratic groups and unions have scrambled to catch up, with their own ads attacking the official GOP nominee, though they remain outspent by conservatives in the days ahead of the Tuesday election.

The frenzy underscores the increasingly prominent role of Crossroads and other independent groups, which have been freed by recent court rulings to raise and spend unlimited amounts of money. Dozens of “super PACs” and other nonprofit groups have formed over the past year to take advantage of those decisions, including a Supreme Court ruling allowing unfettered spending by corporations and unions.

In addition to the New York race, a new pro-Democratic group called Priorities USA Action began running ads in South Carolina on Friday attacking potential GOP presidential candidate Mitt Romney, marking the first official television ad in the race for the White House.

“This is basically a dry run for 2012,” said Meredith McGehee, executive director of the Campaign Legal Center, a nonpartisan group that favors stronger regulation of political expenditures. “As we get closer to the November 2012 elections, each side is testing their game and seeing what works. It’s a whole new ballgame.”

The New York race is the latest sign that 2012 is likely to be a particularly active election for outside political groups, which are not constrained by the same contribution limits as the candidates and political parties. Such groups broke records for midterm elections in 2010, and they appear poised to do the same next year.

One new group called the Republican Super PAC, for example, plans to actively coordinate fundraising with incumbents and favored challengers. Founder James Bopp, a Republican lawyer who has spearheaded numerous challenges to campaign-finance laws, has said he believes a federal ban on coordination between candidates and independent groups applies only to spending, not fundraising.

Two Democratic-leaning groups, Majority PAC and House Majority PAC, have responded by asking the Federal Election Commission to weigh in on the legality of Bopp’s approach. The two groups say they will also enlist the help of lawmakers in raising money if the FEC says it is allowed.

The loosened regulations have helped fuel a spending spree in New York’s 26th District, which features a three-way race between Republican Jane Corwin, Democrat Kathy Hochul and self-described tea party candidate Jack Davis. The candidates are vying to replace Lee, who resigned in February after a gossip Web site released a shirtless picture that the married congressman allegedly sent to a woman he met online.

The district, encompassing the suburbs between Buffalo and Rochester, has long been viewed as one of the safest Republican seats in New York. But the race has tightened in recent weeks amid a strong challenge by Davis and debate over GOP plans to replace the Medicare insurance program with vouchers.

Although Corwin and Davis have each pledged to spend several million dollars of their own money on the race, the contest also features at least $2.2 million in spending by outside groups, according to FEC disclosure reports. About 54 percent of the money has been spent by Republican-leaning organizations, including more than $420,000 by the National Republican Congressional Committee.

The charge from the right has been led by American Crossroads, a conservative super PAC founded last year that has dedicated nearly $700,000 to ads attacking Hochul and Davis. Crossroads and its nonprofit affiliate, Crossroads GPS, has vowed to raise $120 million for the 2012 cycle.

Crossroads spokesman Jonathan Collegio said many special elections often serve as magnets for spending by the parties and outside groups, and the New York race is no different. He said Crossroads will continue to spend heavily in many competitive races through next November.

“The Crossroads groups have stated that we’ll be involved heavily in 2012, both in congressional races and the presidential side as well,” Collegio said.

Other groups funding ads favoring Corwin include the U.S. Chamber of Commerce, the National Rifle Association and the National Right to Life Committee, records show. The Tea Party Express — a national group that has disavowed Davis’s candidacy — is also paying for telephone robocalls and get-out-the-vote efforts in support of Corwin, according to news reports.

Democratic officials and their supporters say Hochul’s chances of capturing the seat remain uncertain, but they say the debate over Medicare and Davis’s un­or­tho­dox campaign give her a clear opportunity. Groups supporting Hochul include the Democratic Congressional Campaign Committee, which has spent about $270,000, and labor groups such as the Communications Workers of America and the Service Employees International Union.

House Majority PAC, which was formed just last month, has spent about $370,000 on television ads attacking Corwin’s stance on Medicare, according to FEC records filed as of Friday. Executive Director Alixandria Lapp said the group decided to jump into the race after seeing an initial surge in spending by American Crossroads and other conservative organizations.

“Their involvement in this race showed us that they were very worried about holding this very Republican district,” Lapp said. “We decided it would be a worthy investment.”

The one candidate who has gotten little direct support from outside groups is Davis, a Republican-turned-Democrat-turned-tea partier who lambastes both parties as tools of multinational corporations and other monied interests. Spokesman Curt Ellis said the factory owner “has been hit from both sides” in the ad wars.

“Jack Davis has said that both the Democratic and Republican parties have been bought by the special interests,” Ellis said. “That’s who’s funding these ads, and that’s why we see both of them attacking Jack.”

Staff writer T.W. Farnam contributed to this report.