Rep. Leon E. Panetta (D-Calif.) compares Congress' longstanding efforts to force President Reagan into a compromise on spending and taxes to a budgetary version of the "Roadrunner" cartoon, with Democrats playing the role of the hapless coyote.

Every time Democrats in Congress think they finally have Reagan boxed in, Panetta said, "he goes 'beep beep' and leaves us in the dust."

When the Democrats, who control the 100th Congress, return Tuesday from their Independence Day recess, they will begin constructing yet another ambush as they make the tactical decisions on implementing their $1 trillion budget. How they go about it could affect the struggle to contain the federal deficit and frame the political debate heading into the 1988 elections.

After adopting a budget whose deficit reduction goal relies to a great extent on a $19.3 billion tax increase that Reagan has promised to veto, Democrats are moving on two fronts in preparation for the next stage of their fiscal battle with the administration.

For the short term, congressional leaders are searching for a way to package the tax increase that exerts the maximum pressure on Reagan to sign it. But anticipating that Reagan will not buckle, some Democrats are already discussing how to turn the expected veto to their political advantage by sending him a tax proposal that targets the wealthy.

Put simply, Democrats who fear that Reagan still commands the high ground on the tax issue are looking for cover. Both politically and fiscally, the stakes in the evolving gamesmanship are high.

Failure to enact the tax increase will likely doom any serious effort this year to reduce the nation's budget deficit, which would then remain above $150 billion heading into an election year, when many lawmakers say it would be impossible to recapture the momentum for reducing it.

On the political side, Democrats are anything but confident they can win the rhetorical battle with Reagan and his Republican allies in Congress. Reagan has only to appeal to the electorate's gut aversion to higher taxes. The Democrats, meanwhile, must make the more difficult case that they are advocating higher taxes not to increase government spending but to rein in the deficit, which to many voters appears at most an abstract threat.

"We are involved in a high-risk gamble," Panetta said. "The real issue is how well do we educate the American people to the . . . failure to deal with the deficit."

Though many Democrats on Capitol Hill are noticeably skittish about voting for a tax increase and thereby handing Republicans a gold-plated campaign issue, they are also increasingly angry at a president who has taken to the hustings to berate the "tax-and-spend" Congress and to push for budget revisions that Congress has repeatedly rejected.

A good barometer of that anger is Rep. Dan Rostenkowski (D-Ill.), chairman of the House Ways and Means Committee, who has a history of working in concert with the administration on such issues as tax revision.

Reagan, Rostenkowski said last week, "hasn't been fair to us. I'm starting to interpret this president on the stump as not only somewhat irresponsible but enjoying it."

Convinced that the only way Reagan will sign a tax increase is if he is faced with a more distasteful alternative, Rostenkowski has thrown his influence behind efforts to replace the automatic spending-reduction mechanism that the Supreme Court struck from the Gramm-Rudman-Hollings balanced-budget law last year. The new "sequestration" provision would require across-the-board budget reductions if Congress and the president do not meet their deficit targets.

Rostenkowski wants the Gramm-Rudman-Hollings fix in place before Congress sends the tax increase to the president, and plans to support efforts to attach it to legislation raising the national debt ceiling, which must be passed late this month. Along with the spending-cut mechanism, which he would put in place for only two years, Rostenkowski wants to ease the deficit targets so they require a $36 billion annual reduction. Now Congress is required to reach a fixed deficit target each year, although legislators have not met it.

A Gramm-Rudman-Hollings law with real teeth would present the president with a stark choice: either accept the Democratic tax increase or face budget cuts that would slash military spending. With his defense buildup at risk, goes this line of reasoning, the president might reconsider his opposition to the tax increase.

But Democrats are anything but sanguine about the prospects. In the first place, they are divided on whether to perfect Gramm-Rudman-Hollings and, if so, how to do it. House Majority Leader Thomas S. Foley (D-Wash.), for example, opposes attaching the Gramm-Rudman-Hollings fix on the debt limit and favors a different sequestration method than Rostenkowski does. Foley prefers wrapping budget-process revisions into the tax legislation, another method of exerting pressure on the president.

Meanwhile, Senate Democrats have suggested putting the tax legislation, the debt limit and budget revisions into one package, but there are doubts there is sufficient time to accomplish this before the debt-limit deadline.

"We are talking about all kinds of things," said Sen. Lawton Chiles (D-Fla.), chairman of the Senate Budget Committee. "It's so fluid it hasn't shaken down yet."

In addition, many Democrats have grave doubts that they can bludgeon Reagan into a budget and tax compromise.

"I personally don't think there's any way to force the president to sign" a tax increase, Foley said.

Though Democrats admit to a collective nervousness about voting for higher taxes in the face of Reagan's high-profile opposition, their resolve is strengthened somewhat by the perception that Reagan's political grip is weakening.

House Budget Committee Chairman William H. Gray III (D-Pa.) said there is "real concern" among House Democrats who "don't want to vote for taxes that aren't achievable." On the other hand, Gray said, there is a growing feeling that Reagan's "bully pulpit isn't working for him."

Lending credence to that analysis is the latest Washington Post-ABC News Poll, which found that the public trusts Congress more than Reagan to reduce the deficit.

Nonetheless, Democrats on the House Ways and Means Committee, which will begin hearings on a tax bill next week, are divided over what form the increase should take.

"There certainly is no consensus either in the committee or on the floor," said Rep. Robert T. Matsui (D-Calif.).

Increasingly, though, Democrats are talking about a tax package that would hit the rich and appeal to their core constituencies. "If he {Reagan} wants to play a political game, then we can come back with a political game," said one Democratic leader. "He'd have to veto something for his fat-cat friends."

As politically satisfying as that might be, a number of Democrats say it will come at the cost of losing an opportunity to drive down the deficit and would saddle the next administration, Democratic or Republican, with a heavy burden.

"That would be a tragic scenario," Gray said. Comparing the budget showdown with a game of "chicken," Gray said, "If someone is going to blink, they better hurry up or else the country is going to be in the wreck."

Staff writer Anne Swardson contributed to this report.