Will the failings of Reaganomics lead to Republican failures in November's congressional elections? Or will effective Republican candidates be able to shrug off their votes for economic policies that haven't yet worked and find other issues to carry them to victory?

In most congressional districts, it is still too early to try to answer those questions, but here in Massachusetts' newest district, a contest already well underway may offer some clues.

Take as evidence the St. Stanislaus Polish church festival:

Eleven o'clock at night, and the temperature hovers around 85 degrees. The raffle is over. Beer is flowing. Paper plates are piled high with pierogi and kielbasa, the potato dumplings and smoked sausage of the old world. Several men in undershirts,crucifixes bouncing on their chests, are dancing the polka with their wives.

And here is Margaret Heckler, the veteran Republican congresswoman, working the crowd. Methodically, she shakes 200 hands, stretching across long formica-topped tables, a Debbie Reynolds smile fixed permanently on her face, missing no one. "Hope you're going to vote for me in November," she shouts above the music. One after another, the parishioners nod enthusiastically, and wish her good luck. "Talk to your friends," she adds. "Be sure to vote, no matter what the weather."

A woman in pink curlers grasps Hecklers hand fervently. "Thank you, thank you," she says. "My brother . . . " Her voice trails off as Heckler moves on. But Amelia Domain is beaming. "I had to thank her in person," she says. "My brother was in Florida. Cancer. She got him moved to the veterans hospital here. She did that favor without even asking us for anything. I tell everybody how nice she is."

Domain, a 58-year-old widow, makes $4.40 an hour trimming and turning pockets in one of this rundown industrial city's many clothing factories. She's a Democrat, a union member, and she has no use for Ronald Reagan. But tell her that Margaret Heckler, a Republican, supported Reagan's program and Domain replies, "I don't believe none o' that baloney." She got a letter from Heckler's opponent, she says. "Frank somebody. But I ripped it up and threw it out."

Few congressional races this fall are likely to be as expensive, as bitterly fought and, perhaps, as much a measure of strength for the battered Democrats as the contest between Margaret Heckler and Barney Frank.

While most candidates are keeping their heads low during the slow summer season, these two have been campaigning hard ever since they were thrown into the same district last December -- a consequence of the 1980 census in which Massachusetts lost one of its 12 congressional seats. The race is one of five in the nation pitting an incumbent Republican against an incumbent Democrat. Heckler and Frank are expected to spend more than $1 million each, an unprecedented amount for a Massachusetts congressional contest.

For the White House, reelecting Heckler is a top priority: She supported Reagan's first-year budget cuts and tax program at considerable political risk in a district that is 2-to-1 Democratic. If she loses, what moderate Republican would want to back the president in the rounds to come?

For the Democrats, reelecting Frank, one of their bright young stars, is a chance for revenge after two years of humiliations. But it is also a test of the proposition that they can beat local Republicans by running against Reagan and his policies. As Ann Lewis, political director of the Democratic National Committee puts it, "You're looking at 10 percent unemployment, the highest business bankruptcies since the Depression. People lining up for food. Kids worried about going to college. Barney will get elected because it will be a referendum on Reaganism."

Lewis is Frank's sister, and that's just another happy coincidence for the pugnacious freshman legislator, whose fundraisers are sponsored by Tip O'Neill and Teddy Kennedy and whose race has been elevated to something of a national cause among liberal groups, many of which have followed his career since his days as the enfant terrible of the Massachusetts legislature.

However, in persuing Heckler, a tough, wily politician with a record of assiduous constituent service, Frank faces the same problem as other Democrats running against moderate Republicans this year: However hard he tries to knot Reagan's coattails around her neck, she's sliding off them as fast as she can.

"Ronald Reagan has proposed a radical right-wing program that endangers our ability to protect the environment, that jeopardizes the ability of the handicapped to get a decent education, that threatens the right of all the people who've worked hard all their lives to live with dignity," Frank thundered at a recent Westport gathering. "If the Reagan supporters in Congress such as Margaret Heckler are reelected, then you're gonna see them go to town next year . . . Medicare will be cut. Social security will be cut."

Back in the district, however, Heckler is known as a fiesty independent. Campaigning on the slogan "Send a Heckler Back to Congress," she doesn't mention Reagan in her speeches. "I march to my own drummer," she sniffs. "I have a great deal of respect for the president, but I'll vote with him when I agree, and against him when I disagree."

As it happens, Heckler mostly agreed with Reagan in 1981 and mostly disagreed in 1982 -- leading Frank's colleagues to joke that he has two votes now, his and hers. This year, Heckler voted against the Reagan budget cuts and in favor of a liberal Democratic alternative sponsored by Rep. David Obey of Wisconsin -- as did Frank. She endorsed the nuclear freeze and voted against the MX missile -- as did Frank.

At 51, Margaret Mary O'Shaughnessy Heckler is the senior woman in Congress and the leading GOP champion of the Equal Rights Amendment. Daughter of a hotel doorman, she was the only woman in her graduating class at Boston College Law School, the first woman to make the Law Review.

A slender, intense figure whose bright pink suits offset her blonde hair, Heckler is a loner in the clubby atmosphere of the House. A senior member of the Veterans Committee, she has worked effectively for medical centers for elderly veterans. But her male colleagues mock her, joking about the way she anguishes over votes, a red card in one hand, a green card in the other, waiting to see how others vote before she casts her ballot.

The cigar-smoking, jocular Frank, by contrast, is ever ready with an opinion, and a quotable quip to match. Son of a truck-stop owner from Bayonne, N.J., he graduated near the top of his class at Harvard Law School while serving in the state House.

He made enemies there, due perhaps to his merciless wit and his inability to suffer fools gladly, but his devotion to liberal causes enabled him to capture Robert Drinan's congressional seat in 1980 when the Pope forced the Jesuit priest to retire. With his 240-pound frame and his loud New Jersey-accented voice, Frank has been unusually visible for a freshman, always ready to defend programs such as legal services for the poor and federally sponsored housing.

If the Democrats are to make this race a political testing ground for the Reagan program, they must first win over people like Amelia Domain.

"Demography is destiny in politics," says Democratic Rep. Edward J. Markey of Massachusetts. "The Irish, French and Portuguese Catholics in that district will vote the economy, vote their pocketbook. That's Barney's real opportunity. These people are Democrats for a reason. Reaganomics is reminding them that education, job training, unemployment and Social Security are Democratic issues."

Unemployment in the new district ranges from 5.7 percent in Brookline to 12 percent in Fall River. If it gets worse, Frank figures his chances can only get better. But today, as one unemployed Fall Riverite puts it, "It's a recession if you're out of work. It's not a recession if you're working."

In the salamander-shaped district stretching from the Rhode Island border to the suburbs west of Boston, there are 115,000 registered Democrats, 119,000 independents and 44,000 Republicans. That's good for Frank.

But as the Massachusetts legislature (which has little use for uppity reformers) drew the lines, 70 percent of those people are Heckler's old constituents and fewer than 30 percent are Frank's. The Amelia Domains of Fall River tend to be loyal to their own and suspicious of outsiders. Traditionally in congressional elections, incumbency weighs more than party affiliation, and Heckler is hoping the tradition will endure.

During 16 years in office, Heckler has relentlessly chased federal grants and lost Social Security checks. She has campaigned indefatigably from the antique-filled living rooms of Wellesley to Fall River's grimy factories. When an earthquake rocked the Azores a few years back, Heckler flew there to publicize her concern -- no small matter for Fall River, where 68 percent of the population is of Portuguese descent. When a fire devastated a local church and surrounding homes this spring, she was on the scene within hours.

"There's no substitute for getting results for the people you represent," she says. "When it comes to issues, there's no philosophically correct position. Whatever stand you take, you enthuse some and outrage others. But by being the liason with the federal government, and serving constituents' needs -- that's one of the most essential things for members of Congress. Fall River does not need a debater in the halls of Congress."

However, like other moderate Republicans up for reelection, Heckler walks a tightrope.

Massachusetts voters were treated to a comical performance of her balancing act last month when Treasury Secretary Donald Regan appeared at a $500-a-plate luncheon on her behalf at the Sheraton Boston Hotel. After raising about $75,000 for her campaign, Regan emerged for the usual "photo opportunity" with the local press. But Heckler was nowhere to be seen, having scurried off to another appointment.

"Rep. Heckler, you can't have it both ways," editorialized the Boston Herald American the next day. "You can't hitch your wagon to the White House to suit your own purposes and then race off, treating its representatives as though they had a contageous disease."

Nonethless, Heckler has shown a shrewd ability to use the White House to her own advantage. In a lightening raid into Frank's territory, she obtained a $4.2 million federal grant to turn an outmoded school in Newton into low- and moderate-income housing. Newton's mayor, calling it "a miracle," gladly posed for photographs with her.

In another instance, Frank complained, "I got EPA to clean up a lake in Nadick, and they let her announce it!"

Despite his effort to focus on Reaganomics, Frank is not above posturing on a pork barrel. When he discovered Heckler's plan to bring Transportation Secretary Drew Lewis to Somerset to discuss a $50 million bridge renovation, Frank hauled New Jersey Democrat James Howard, chairman of the House Public Works and Transportation Committee, up to the bridge for a preemptive strike press conference. Neither Heckler nor Frank got a promise of funding, but Lewis dutifully told the media that because of Heckler's persistence, the Brightman St. Bridge should be renamed the "Peggy Heckler Bridge."

Most recently, Heckler derailed Frank's strategy by jumping on the congressional page issue. Her "own feelings as a mother of three children" prompted her to call for an independent investigation of the allegations of homosexual propositioning and cocaine use by congressmen, she said on the Today Show. Frank, a 42-year old bachelor, was reduced to me-tooing. Popping up on the floor of the House immediately after Heckler's speech on the subject, Frank pointedly noted that an independent investigation was indeed needed to examine the charges, "some of which have been quite demagogically exploited."

Meanwhile, the Massachusetts delegation was buzzing indignantly that Heckler's insistence on the issue, and her emphasis on her own family status, was the beginning of a dirty campaign of innuendo. In the legislature, Frank had championing gay rights, and the issue was used against him, along with his advocacy of freedom of choice in abortion, in his 1980 race.

In Boston, a favorite joke is about the lady from out of town who says to the lady from Boston, "I love your hat. Where did you get it?" The Bostonian replies, "In Boston, we simply have our hats."

That kind of snooty don't-try-to-be-one-of- us mentality is a factor in the Heckler-Frank race, pitting, as it does, an Irish Catholic against a New Jersey Jew in a state where ethnic politics flourishes like no place else.

One Massachusetts Republican predicts, "She'll play the O'Shaughnessy to the hilt" in the Southern end of the district. When the Fall River United Labor Council endorsed Frank, Heckler reportedly complained to the union leaders that the endorsement had been made on a religious holiday, "when I was in church, and when Mr. Frank was in temple, or wherever it is he goes."

Heckler says she meant no harm by the remark, and denies she is using the page issue for political ends. Her supporters say Frank, who has made a national direct-mail fundraising pitch based on his support "of Israel and World Jewry," is using his own ethnic heritage to his advantage among the large Jewish population of Brookline and Newton.

In those sophisticated Boston suburbs, Frank's legendary one-liners are a big hit. Columnist Ellen Goodman's favorite Frank quote: "This administration believes that life begins at conception and ends at birth."

In the legislature he once remarked that trying to help the upright Gov. Michael Dukakis get his program through without patronage was "like pimping for a nun." At an ERA rally a few weeks ago, as Sen. Paul Tsongas read an interminable list of organizations for equal rights, Frank whispered, "Pages and coke dealers for equal rights."

Frank's supporters are worried that the humor won't go over so well at places like the St. Stanislaus Polish Church festival. It's the cultural gap. As Boston Herald columnist Howie Carr put it a few months ago, "Barney Frank is the bottle bill. Barney Frank is Save the Whales." The Democrats in Bristol County, at the southern end of the district, Carr wrote, "are not the right kind of Democrats. Bristol County Democrats don't buy UNICEF Christmas cards . . . What (they) do is hang rubber dice from the rearview mirrors of their Impalas. That and vote for Margaret Heckler . . ."

In the end, it may be less a matter of how Ronald Reagan plays in Fall River than how Barney Frank plays. The same weekend that Heckler hit the St. Stanislaus festival, Frank was there, too, sweating profusely in the July heatwave, his face bleeding slightly where he had shaved off a mosquito bite that morning, a hole in the seam of his pants. (An old Frank campaign poster once pictured his oft-dissheviled figure under the slogan, "Neatness isn't everything.")

What Barney Frank likes is legislating. Campaigning is something that goes with the job, and he doesn't pretend very hard to enjoy it. However, a CBS crew is there this day, so Frank tries hard -- but nothing seems to be going right. Frank waits 15 minutes in the parking lot for "his introducers." When they finally turn up, there are only a handful of voters to shake hands with. "Hi," he says, stretching out his hand to a lady in a colorful costume. "Barney Frank. How are you?" The lady looks bewildered. Frank forgot to say that he was running for Congress or that he wanted her vote. "Barney who?" she asked an onlooker.

As he leaves the festival, an elderly couple, Theodore and Doris Ziolkowski, ask his position on bilingual education. Ah, an issue. Barney is finally in his element. He launches into a lecture on the merits of bilingual programs.

Ziolkowski tries to get a word in edgewise. "My folks came from Poland," he begins. "I couldn't speak a word of English -- "

Frank interrupts to tell him that he, too, is Polish, and launches back into the lecture. Ziolkowski tries to get back into the conversation, but he is drowned out, Bayonne-style.

Afterward, as Frank is climbing into his car, chauffeured by a young woman who graduated from Harvard this June, Ziolkowski says he is undecided on the race. But he might vote for "Barney Miller," he confides.