President Reagan kept the United States in compliance with the unratified SALT II agreement yesterday by ordering the dismantling of two Poseidon submarines, but he warned Moscow that he is prepared to exceed one of the treaty's limits on nuclear arms by the end of the year.

Reagan's decision followed State Department recommendations to continue compliance with SALT II despite repeated U.S. charges of Soviet violations of the agreement. But the president explained his action with an argument advanced by Pentagon officials, saying that he was acting on budgetary and military grounds rather than complying with a treaty he described again yesterday as "fatally flawed."

In a statement in which he also said that future U.S. action must be based on the "magnitude of the threat" from the Soviets, the president said he had ordered that two 20-year-old submarines, the Nathan Hale and Nathanael Greene, each carrying 16 missiles, be dismantled to offset the introduction of the Trident submarine Nevada, which begins sea trials today. If the Poseidons had remained in service, the Nevada's 24 missile launchers would have put the United States over SALT II limits of 1,200 multiple-warhead, long-range missile launchers.

However, the president said he would make "an appropriate response" to Soviet violations by continuing to deploy B52 bombers armed with air-launched cruise missiles (ALCMs) unless the Soviets take "constructive steps" toward compliance. When the 131st ALCM-carrying bomber is deployed, probably in December, the United States would exceed the SALT II limits.

Despite this warning, administration officials said the United States could quickly fall below the SALT II limits again next year because two other Poseidons also may be dismantled for military and economic reasons. If this happened, the United States probably would be in compliance with the treaty until the next Trident is commissioned, in 1988.

One of these Poseidon submarines, the Alexander Hamilton, would have been among the two that Reagan ordered dismantled yesterday, according to a senior official, but the Nathanael Greene was substituted because it had run aground and been damaged.

Reagan had been urged by Secretary of Defense Caspar W. Weinberger and Senate conservatives to keep the Nathan Hale and Nathanael Greene in service as a sign that the United States would no longer tolerate Soviet violations of SALT II. But a senior official said the president decided against this after he was told that it would cost $136 million to overhaul and refuel each of the older Poseidons.

"That's a pretty expensive political statement," a senior official said yesterday.

In an indication that the Pentagon is fighting to preserve its anti-SALT II position, a Senate source said that Navy officials had told him yesterday that the service is planning to overhaul three older Poseidons, including the Alexander Hamilton, rather than drydock or dismantle them. But administration officials emphasized that the final decision on each submarine will be made by the president based on military needs and considerations of cost effectiveness.

The president's decision, which officials said was conveyed beforehand to the Soviets through diplomatic channels, yesterday provoked critical reaction from Senate Majority Leader Robert J. Dole (R-Kan.) and a mixed response from leading Democrats, who praised Reagan's action while questioning his rhetoric.

"I am concerned that the decision sends the wrong signal to the Kremlin," Dole said in a statement that reflected the view of 25 senators who on March 12 had urged Reagan to renounce the SALT II treaty. "We cannot continue to abide by an agreement -- an unratified agreement, at that -- which the Soviets are so blatantly violating."

But Senate Minority Leader Robert C. Byrd (D-W.Va.) said that "despite the rhetoric," which he said appeared to prejudge the outcome of U.S.-Soviet arms control negotiations, "the important thing is that the U.S. today remains in compliance."

Sen. Edward M. Kennedy (D-Mass.) said "the decision is sound and it's regrettable that the president saw fit to bow to right-wing pressure and disparage the arms control rationale. The next decision is not for six months, and I hope it will come after a successful summit meeting."

White House spokesman Larry Speakes announced the decision at a briefing where he said that any change in the administration position would require "a radical change in Soviet behavior." He said that Reagan was proceeding on the assumption that he would hold a second summit meeting this year with Soviet leader Mikhail Gorbachev. Administration officials have said they expect that a summit, if it comes, will be held in November after the midterm congressional elections.

At a briefing that seemed directed more at soothing Republicans who object to the decision than Democrats who complained about Reagan's rhetoric, Speakes repeatedly denounced Soviet behavior.

"We've gone the extra mile, we've waited and waited on the Soviets and still we see no change in their behavior, either on cheating on SALT II and SALT I agreements and various other agreements. We see no change in their rapid and extensive buildup. . . ," Speakes said.

Reagan said in his statement and Speakes repeated in his briefing that the United States would "take into account" Soviet behavior in the next six months before making a final decision to exceed the SALT II limits on the number of B52s carrying air-launched cruise missiles. But Speakes declined repeatedly to specify what the Soviets would have to do to cause the president to reverse the position he took yesterday.

For the past three years Reagan has been complaining of Soviet violations of the SALT II treaty. He said in his statement yesterday that despite "some modest indications of improvement in one or two areas, there has been no real progress toward meeting U.S. concerns with respect to the general pattern of Soviet non-compliance. . . . " He cited in particular the continued deployment of the SS25, a mobile, single-warhead ICBM, which he described as "a forbidden second new intercontinental ballistic missile." Reagan also said that the Soviets continue to hide ballistic missile test data, which makes it difficult to verify compliance and is barred by the treaty.

Despite saying that the United States might exceed one of the limits of SALT II, Reagan said he did not "anticipate any appreciative numerical growth in U.S. strategic forces" and that, "assuming no significant change in the threat we face," would not deploy more nuclear delivery systems or warheads than the Soviet Union.

"I call on the Soviet Union to seize the opportunity to join us now in establishing an interim framework of truly mutual restraint," Reagan said.