It was to have been the political equivalent of a perfect marriage. Instead, it has been more like a surly squabble among in-laws. And there will be a lot of empty seats at the family reunion next week.

During the four years since Jimmy Carter stumped the country pledging a close, fruitful realationship between a Democratic White House and the Democratic Congress, their mutual achievements -- and there have been some -- have been upstaged by a recurring clash of styles, personalities and political interests.

Now, afraid that a Republican tidal wave might spill out of the presidential race into their own reelection contests, many congressional Democrats are trying to put maximum distance between themselves and their beleagured president.

Not only are most of them giving a wide berth to next week's Democratic National Convention, which only eight senators and 42 House members will attend as delegates or alternates, but many are going out of their way to accentuate their differences with Carter.

"It's the first law of nature -- survival," said Sen. Dale Bumpers (D-Ark.), who is a Carter supporter and, unlike many of his colleagues, a safe bet for reelection this fall. "The anxiety level is pretty high around here."

And beyond the panicky urge for self-preservation, the congressional wing of the Democratic Party functions according to another important rule of self-interest: House and Senate Democrats are more powerful, more celebrated and self-important, if there is a Republican in the White House. A Democratic president overshadows them and tries to command them.

But if Jimmy Carter loses to Ronald Reagan this fall, that automatically elevates Senate Majority Leader Robert C. Byrd and House Speaker Thomas P. (Tip) O'Neill Jr. to preeminence as the ranking Democratic leaders for the nation. Capitol Hill Democrats, generally, have never shown much affection for their leader in the White House, so it is not as though they are turning on a cherished old friend.

In any case, "the possibility is there for a tidal wave, an avalanche," said Richard P. Conlon, director of the House Democratic Study Group, "and more and more members are becoming aware of it."

"They're running away from him [Carter] as fast as they can," said a retiring senior member of Congress. "I haven't seen anything like it since Harry Truman in 1948."

For the Democrats, the good news is that Truman was elected in his own right and the Democrats captured control of Congress from the Republicans.

The bad news is that 1980 is quite different from 1948 and Carter, most congressional Democrats agree, is cut from a difference cloth than Truman.

With the increasing independence and ticket-splitting inclination of voters, few Democrats put much stock any more in the notion of a "coattail effect" from presidential candidates. Nor do all of them, by any means, rule out a Carter comeback in the polls. Some think it will happen; more think it could happen.

What worries them is the hint in current polls of a throw-'em-all-out Republican sweep that would undercut Democratic strength across the board. "Tidal wave effect" is the cliche of the hyper-jittery climate of 1980 congresstional politics.

Take Sen. Gary Hart (D-Colo.), for instance. If this were a normal year, Hart figures he would be in pretty good shape. But he can't count on going into the election with just enough votes to win. He says he's got to cushion his margin sufficiently to withstand a possible battering from afar, from forces out of his control.

For colleagues such as Sens. George McGovern (D-S.D.) and John C. Culver (D-Iowa), who were running behind in the polls even before Carter began his most recent slide, the problem is even more acute.

"It's like a skier under a snow overhang and with no place to go," said Conlon.

Even by Democratic reckoning, a half-dozen Senate Democrats and several dozen Democratic House members may be in the serious trouble this fall.

With the Democratis holding 59 of the 100 Senate seats and 274 of the 435 House seats, they could withstand such a loss and still retain control of both chambers.

But much more of a loss, especially in the Senate, where a switch of 10 votes could put the Republicans in control (or less if some conservatives were persuaded to switch parties could end the Democrats' quarter-century reign over Capitol Hill. In any case, Republicans hope to gain enough to help them push over the top in 1982.

Barring a landslide that wipes them out, too, some Democrats say there could be some benefits if the Democrats lose the White House, although they emphasize they are not advocating defeat.

"The time is ripe for our party to rethink its conceptual, post-New Deal framework," said Hart, who argues that the party must retool its ideology and policies in light of fundamental changes in both domestic and international circumstances since Franklin Delane Roosevelt virtually recreated the party in the 1930s.

"And an opposition administration," he said, "would give us time and would force us, especially the newer people, to rethink the party's future in broad terms."

Another senator and a House member, in almost identical words, suggested that the congressional Democrats appear not only more unified but also more forceful when butting heads with a Republican administration. Their leaders, too, become leaders of a government-in-exile, freed of conflicting pressures from their own troops and their commander-in-chief. "Let's face it," said the House member, "we probably looked better under Nixon and Ford than we do under Carter."

It is quite possible that, if Carter were riding high in the polls, he would be getting better ratings from Congress -- and a few less brickbats in the form of calls for an "open" convention under which committed delegates would be free to vote for anyone on the first ballot.

The problem is that one feeds on the other. The more Carter sinks in the polls, the more that members of Congress remember their grievances against Carter: inconsistency of policy and priorities, lack of consultation and coordination, insensitivity to local political imperatives, failure to build a constituency in the country for controversial programs that he hands over to Congress and then appears, in their eyes, to forget.

All of this has contributed to the ever-widening distance between Carter and Byrd (D-W.Va.), who has been repeatedly irritated by White House handling of legislation and senatorial prerogatives and appears haunted by fears of Democratic losses in the Senate.

Ever-anxious to keep the Senate under Democratic control, Byrd was the only congressional leader to join the "open" convention boomlet.

Asked for the one thing that Carter could have done to improve his congressional relations, Senate Minority Leader Howard H. Baker Jr. (R-Tenn.) said: "Make friends with Byrd." Added Baker: "The only way to make this system work is a useful relationship with the majority and the minority, and Carter doesn't have either."

Not everyone on Capitol Hill blames Carter alone, however.

"Presidents are generally more concerned with national interests than members of Congress," said retiring Sen. Abraham A. Ribicoff (D-Conn.). "Special interests are using their minority power to scare politicians who don't realize what a minority they are . . . I've never seen politicians so fearful. They'd be a lot better off if they told them [special interest representatives] to go to hell. People would love 'em for it."

House Majority Whip John Brademas (D-Ind.) also offers a sympathetic analysis of Carter's problems with Congress.

Largely as a result of Watergate, Vietnam and other events that preceeded Carter's arrival in Washington, Brademas said, the power of Congress has risen relative to that of the White House. But within Congress, party discipline has declined and power has proliferated, thereby clogging the old channels of leadership. In such an environment, any president would have problems, he added.

The Carter administration argues that, all things considered, its record of legislative accomplishment is as strong as any recent president's and, in some cases, much better.

Brademas points to Carter victories in Congress, which have ranged from the Panama Canal treaties to civil service reform, deregulation of several major industries and most of his energy program.

But Carter has also suffered humiliating defeats, including a testy reaction to many of his economic proposals. Most recently, Congress unceremoniously dumped his 10-cents-a-gallon fee on gasoline to reduce imports, even though there appeared to be no big voter revolt over it.

"It's gotten to the point where there can be a negative response from Congress simply because the White House has gotten involved," said Rep. Leon E. Panetta (D-Calif.). There have even been suggestions that the White House lay low on an issue it cares about to avoid alienating people, Panetta added.

Conlon attributes a large part of Carter's problem to the fact that "he's picked issues that divide Democrats rather than unite them." He cited Carter's attack on water project spending, his emphasis on energy (which pits "oil producers against oil burners") and even his advocacy of a Department of Education, which divided teacher unions.

Others suggest, however, that Carter's agenda aside, it may be hard to find many issues that unite Democrats these days. Carter's failure, they say, was to create a constituency in the country for his programs that would compel the attention of Congress and lengthen its normally short attention span.

For all their grousing, however, the Democrats in Congress have played little more than a sideshow role in the outcome of the party's presidential drama.

One participant recalled the sequence of events this way: Many who were unhappy with Carter urged Sen. Edward M. Kennedy (D-Mass.) to run last year, when his prospects looked brighter than they turned out to be. Then, as Kennedy faded, they figured Carter might well make it. By the time people started practicing saying "President Reagan" it was too late.

The "open" convention drive organized mainly by some junior House members might have gone farther if it had started earlier, included more senior members and held out the prospect of producing someone other than Kennedy, several members suggested.

The congressional posture may well have been summed up by Senate Majority Whip Alan Cranston (D-Calif.) in a preconvention press conference. He arrived wearing a "Joe Walsh for President" lapel button. Who, he was asked, is Joe Walsh. Answer: A rock musician who helped Cranston raise $100,000 for his reelection campaign.