Without ever leaving downtown Washington, President Carter managed to campaign yesterday, successfully pulling the levers of power and commanding the media channels that are uniquely available to him in his race for the Democratic presidential nomination.

His words through much of the day had to do with the continuing stale-mate in Iran, but always against the landscape of elections in Wisconsin and Kansas. He won both places.

His day began shortly after 7 in the morning, as the voters in Wisconsin and Kansas started going to the polls, when he strode into the Oval Office of the White House to announce to waiting reporters and television cameras that there had been "a positive step" in the Iranian hostage crisis.

Some 15 hours later -- when the news from Iran was not so positive -- the president's press secretary, Jody Powell, accepted for him the fruits of the White House labors as reflected in the Wisconsin and Kansas Democratic primary vote totals.

Powell was asked whether the last few days' events in Iran, particularly yesterday morning's presidential announcement of progress, might have affected the primary outcomes.

"That's very difficult to say," he said."Generally we find that it takes about 24 hours for any significant event to have an effect on the voting in states. These sorts of margins could hardly be attributed to any late-breaking event."

That may have been the case, but yesterday morning, when he entered the Oval Office for his announcement, the president was taking no chances. The subject of the moment was Iran, but the unusual early-morning presidential appearance was more an exercise in domestic politics than international diplomacy.

The timing itself was meant to coincide with the early-morning television news programs, which broadcast Carter's announcement of new hope in the hostage crisis well before most of the votes were cast in Wisconsin and Kansas.

In this and other aspects, the president's performance in recent days, climaxed by yesterday's events, was reminiscent of other presidents who sought to turn international turmoil to political advantage -- Lyndon B. Johnson, for example, who ordered a halt to the bombing of Vietnam four days before the 1968 presidential election in a vain attempt to salvage victory for his vice president, Hubert M. Humphrey, or Richard M. Nixon's announcement that "peace is at hand" in Vietnam just before the 1972 election. a

White House officials insisted yesterday that there was no connection between the last few days' race to achieve some sign of movement in the hostage stalemate and Carter's fortunes in the relentless political calendar. "We don't make decisions like this based on primaries," a senior aide said.

But whatever the details of the secret negotiations with the Iranian government, yesterday clearly marked a political turning point for the president. After days of increasing defensiveness over his handling of the hostages situation, he went on the offensive.

Before the day was over, Carter had appeared before an organized-labor audience, where he appealed for unity in the crisis on the basis of "patriotism" and voiced a broad attack on all of his political opponents that came close to crossing the line into partisan activity, which he has forsworn until the hostages are released.

The political backdrop for this flurry of presidential activity could be found not in Tehran, but in the findings of nervous Carter political operatives in Wisconsin who sensed a growing erosion in the president's support as confusion enveloped the Iranian crisis.

Just four days before the Wisconsin balloting, Carter's pollster, Patrick Caddell, said that the results there would be determined "by events in the real world, not by organization or campaigning." And administration officals seemed anxious to assure that the roller coaster of expectations that has characterized the Iranian crisis would be at a high point on election day.

Over the weekend, Carter campaign officials were nervous about what they felt was a "churning" of voter sentiment in Wisconsin. Network news accounts Sunday that outlined the confusion -- and raised the specter of duplicity -- over whether Carter had sent a message of apology to Iran were politically "disastrous," according to Caddell.

In his surveys Caddell found "a significant upward movement" in the percentage of those who agreed with the statement that "carter cannot handle the presidency." Caddell believed this was directly related to an increased frustration with the president's efforts to end the Iranian crisis.

In messages to leaders in Iran, Carter set a deadline of March 31 -- the day before the Wisconsin and Kansas primaries -- for imposition of new U.S sanctions if the Iranian government did not take steps to gain control of the hostages. Carter officials had hoped that the president would be able to announce his decision Monday -- a move Caddell had predicted would help "stabilize the situation."

When events in Tehran forced a delay in Carter's statement until yesterday -- election day -- it presented a serious political problem of how to get the optimistic news to the voters before they went to the polls. The solution, it turned out, was the early appearance before the cameras in the Oval Office -- just in time to make the network news shows on election morning.

While Carter was awaiting that late-arriving word out of Tehran Monday, his chief campaign surrogate, Vice President Mondale, was in Wisconsin offering assurances. At a rally at a high school, when Mondale assured his audience that the United States had not sent a message of apology because the United States had nothing to apologize about, he elicited prolonged applause.

Speaking yesterday to the AFL-CIO building and construction trades department, the president invoked the same hard-line sentiment, provoking a wildly enthusiastic standing ovation.

Carter's speech contained some of the tough language he had employed in the early weeks of the Iranian crisis, when the country rallied behind him and his popularity soared after the hostages were seized last Nov. 4.

He was tough on the Iranians, warning them that American patience "is not endless."

He was tough on the Soviet Union, warning that the United States "will stand firm, we will not yield" to its agression in Afghanistan.

But he was toughest of all on his political opponents, none of whom he named.

"In this election year, we also hear the easy promises -- the promises that appeal to a particular audience at a particular time," the president said.

One such "easy promise," he said, comes from those who assert that "wage and price controls are the easy and painless answer [to inflation] when we know that they have failed in the past . . ."

Carter's chief Democratic primary rival, Sen. Edward M. Kennedy (Mass.), is a strong advociate of mandatory wage and price controls.

Another such "easy promise," the president said, comes from those who assert "that we can just shut down our entire nuclear industry . . ." The other Democratic presidential contender, California Gov. Edmund G. (Jerry) Brown Jr., has called for phased elimination of nuclear power plants.

But the president's strongest rhetoric was clearly directed at the Republicans and the likely GOP presidential nominee, Ronald Reagan.

"We must act together [to combat inflation] with the full knowledge that if we fail somebody else will try to solve this problem who does not have our commitment to jobs and to economic justice," he said.

"During this election year, we are hearing again from people whose solution is to destroy the gains that have been made for the working people of America . . . These people are ready to dismantle programs that have taken decades to build."