In the near future, when, in all probability, the Panama Canal treaties are ratified by the Senate, there will be understandable cheering in the White House, but there could well be even more jubilation among moderate Republicans at seeing the supposedly dominant right-wingers of their party finally get their comeuppance.

The growing consensus here is that the GOP conservative bloc, which has staked so much on derailing the treaties, is on the brink of a major setback that could not only shake its longtime minority control in Congress, but also thwart its goal of taking over the party and dictating the choice of its 1980 presidential candidate.

There wasn't anything accidental about the hard-liners' picking a primitive issue like the canal as a means of challenging the Carter administration, while simultaneously putting the GOP moderates on the spot. They thought they had a sure thing; and it must be conceded that at the outset of the fight many, if not most, of the moderates appeared to be intimidated.

The treaty opponents calculated, not unreasonably, that the moderates in an election year like 1978 would shrink from offending the conservative wing of a generally conservative party for fear of defections in November or, worse, exposing themselves to a primary fight.

Those calculations would have proved sound if the treaties had been rushed to a vote last fall. Delaying the debate until now, though, allowed the moderates to lie low and hope that public opinion would swing their way, which it has.

Sensing that, the hard-liners have been driven to overkill. In recent weeks, their attacks have been so demagogic, and their tactics so personal and wounding, that they have alientated fence-sitting senators they might once have counted on.

It takes a two-thirds majority of 67 Senate votes to ratify a treaty, but only 34 votes to reject. Not long ago the anti-treaty forces were boasting that they would produce 50 or more votes when the showdown came, yet on a test tally involving a procedural question, the pro-canal vote was 67 to 30. Later, a "killer" amendment was beaten by 55 to 34.

The way things are going, the opposition in the end may not be able to rally more than 25 or 26 votes. In fact, one of the leaders of the anti-treaty forces, Howard Phillips, who is director of the "New Right" organization, now thinks only 22 senators are likely to vote against the treaties.

Of that group, 18 are Republicans - fewer than half of the 38 Senate GOP members. If Phillips is right, it would be the first time in years that the Republican conservatives failed to roll lup a majority in their own party.

On early premise of the right-winders that went awry was that prominent GOP officials who had national ambitions for 1980 would have to play ball or invite the kind of opposition that almost defeated Ford for nomination in 1976.

However, such figures as Howard Baker, the Senate minority leader, and former senator Bill Brock, chairman of the Republican National Committee, found ways of resisting the pressure, as did other presidential hopefuls like Sen. Lowell Weicker (R-Conn.).

The ensuing fury of the anti-treaty bloc has boomeranged. After Sen. Baker joined Sen. Robert Byrd (D.-W.Va.) in a bipartisan blessing of the treaties, 14 House Republicans demanded that he resign as minority leader. They accused him of "betraying" the country.

They suggested that Sen. Robert Griffin (R-Mich.), the only member of the Foreign Relations Committee to vote against the treaties, be the new leader. Griffin was "shocked" and "outraged" at the idea. He said Baker had been "scrupulously fair" during the debate.

If the Senate were less circumspect, it would have been reduced to laughter when Sen. Jake Garn (R-Utah) interrupted the Panama debate to announce that the American people did not want treaties made "with a corrupt military dictatorship."

Later, a fellow senator privately remarked, "What's Jake talking about? Under Nixon and Ford, all we Republicans did was support military dictatorships from Vietnam to Greece, from Chile to South Korea. So did the Democrats. And we're still doing it all over the world under Cater."

When Congress returned to Washington after the holiday recess, many members compared notes on how their constituents felt about the treaty argument. There was surprising agreement that former secretary of state Henry Kissinger had struck the most telling blow for the treaties when he said:

"A defeat for the treaties would suggest to friends and foes around the world that the United States could not deliver on an agreement negotiated by four presidents of both political parties over a period of 13 years, that it could not perceive its own interests in Western Hemisphere cooperation, and that shifting emotions and institutional statements produced erratic behavior in the most powerful country in the world."

The unanimity of recent presidents, plus united support by the present Joint Chiefs of Staff, apparently has greatly deflated wild charges that the treaties are a "giveaway," a "sellout to Marxism" and a "betrayal." The public seems to sense that such talk verges on the idiom of cranks.