President Reagan said yesterday he had worked out a "bipartisan agreement" with Congress to save the MX missile but key members of both parties quickly said there was not an agreement, setting up further tests of strength on the issue before adjournment.

"It ought to be very clearly understood that the so-called compromise was reached within a certain group," said Sen. Mark O. Hatfield (R-Ore.), an MX opponent and chairman of the Senate Appropriations Committee where the first of the test votes is expected today.

The committee, in marking up a stopgap funding measure for most of the government, including the Pentagon, will vote whether to include $988 million the House deleted to put the MX missile into production.

Reagan, in an effort to save face and rescue that money, said yesterday that he had agreed to a compromise under which Congress would vote it but he could not spend it until next year. This would give the House and Senate more time to study proposals for basing the intercontinental nuclear missile.

Under the compromise worked out with Republican leaders and two senior Senate Democrats, Reagan would send Congress fresh assessments of various deployment schemes, recommending one by March 1.

The House and Senate would have to vote this one up or down by April 15.

The production funds could not be spent unless they voted it up.

"There is no reason to lock ourselves into any kind of restrictions," Hatfield said in rejecting these terms. "There have been 31 basing modes [proposed] so far; there is no reason to lock ourselves into a specific time agreement. They're trying to salvage a victory out of defeat."

Sen. Ernest F. Hollings (D-S. C.), a member of the Appropriations Committee and leading MX opponent, said he was not about to give up, either. "I haven't lost any support," Hollings said. "I keep gaining every day."

Hatfield said the vote on his committee on the $988 million for MX production would be close. According to committee sources, it will hinge largely on four Republicans: Mark Andrews (N.D.), Warren Rudman (N.H.), Arlen Specter (Pa.) and Lowell P. Weicker Jr. (Conn.).

In interviews, Andrews said he is leaning against the missile; Specter is, too. Rudman is with the president.

If Reagan prevails in committee today, there are likely to be further tests on the Senate floor and in the House. Reagan could also veto a continuing resolution if MX production money were not included.

Asked yesterday if the House would reverse its 245-to-176 vote against the MX production money by including it in a continuing resolution, Speaker Thomas P. O'Neill Jr. (D-Mass.) said, "I doubt it at the present time, unless there would be a tremendous change in the feeling out there."

He added that the House voting "started out" as a protest against the president's recommended Dense Pack deployment proposal for the MX rather than the missile itself. "But it's deeper than that," he said.

Dense Pack calls for burying 100 MX missiles so close together in the Wyoming prairie that attacking Soviet nuclear warheads theoretically would knock each other out as they exploded over the missile field.

Rep. Jack Edwards of Alabama, ranking Republican on the House Appropriations subcommittee on defense and leader of pro-MX forces there, agreed with O'Neill that "it would be very hand" to reverse the earlier adverse vote on the MX. "The House has spoken rather loudly, I think," he said.

Reagan was flanked by Senate Majority Leader Howard H. Baker Jr. (Tenn.), Republican whip Ted Stevens (R-Alaska), Chairman John G. Tower (R-Tex.) of the Senate Armed Services Committee and House Minority Leader Robert H. Michel (R-Ill.) as he announced his agreement to the compromise plan.

Reagan said his objective was to keep MX production on schedule while giving Congress more time to study the Dense Pack basing scheme. He said he was not backing off from that deployment proposal, terming it the one "with the least warts."

Tower said the 45-day limitation for Congress to vote on a basing scheme is designed to avoid a filibuster. Baker confirmed Hatfield's view that the immediate future of the MX in the Senate will depend on what happens in today's mark-up of the continuing resolution. "My guess is that there is not now time to have a free-standing bill, and we will probably make it a part of the continuing resolution," he said. That would leave the House-passed bill appropriating $231 billion for the Pentagon in limbo.

This legislative situation prompted Reagan administration officials to focus their lobbying efforts on Senate Appropriations. The president himself is expected to telephone wavering Republicans there in hopes of swinging the MX vote his way.

Sens. Henry M. Jackson (D-Wash.), who is slated to become ranking minority member of the Armed Services Committee next year, and Sam Nunn (D-Ga.) helped Reagan fashion the MX compromise outlined yesterday, according to the White House. It was their support that let him call the compromise bipartisan.

Jackson predicted "a hard tough battle" to push the compromise through the lame-duck session. He also warned that if Reagan, after reassessing deployment possibilities for the MX, resubmits Dense Pack next year, "it's dead" in Congress.

Nunn said "a key element of the compromise is the requirement for a reexamination by the president of the Dense Pack basing mode as well as other options."

However, Defense Secretary Caspar W. Weinberger told the Senate Foreign Relations Committee yesterday that "as far as fallback positions or alternative systems" to Dense Pack, "frankly, we don't have any."

Sen. John H. Glenn (D-Ohio) complained during that hearing that he had never received a good explanation from the Pentagon on why the next U.S. land missile could not be made truly mobile by having it trucked around the country. He said the Soviet SS-20 is deployed this way.

Sen. Larry Pressler (R-S.D.) told Weinberger that he did not accept the Pentagon argument that existing Minuteman silos and Minuteman accuracy could not be upgraded to the point that they could substitute for MX. Weinberger countered that the Minuteman missiles are spread so far apart that they could be isolated by attacking Soviet warheads and destroyed.