Even before the American hostages had left Lebanon on their journey to freedom, President Reagan's advisers were trying to use positive public reaction to their release to advance the president's policies and programs.

A White House official who only a few days ago expressed concern that the Mideast hijacking would "Carterize" the Reagan presidency said yesterday that Reagan "now has control of the agenda again."

As the 17-day ordeal of the hostages neared its end, White House officials launched a campaign designed to demonstrate that Reagan personally was the principal architect of the solution.

Networks and newspapers were provided with 14 photos showing the president conferring with his principal aides at different stages of the crisis.

The White House released a seven-page summary of events that stressed intense presidential involvement in the crisis and concluded with Reagan's nationally televised call yesterday "to stamp out this ugly, vicious evil of terrorism."

Earlier, White House spokesman Larry Speakes said that Reagan may greet the hostages when they reach U.S. soil. He also suggested that the president, who last week canceled a visit to his California ranch, would stay on the job throughout this week's congressional recess.

Other officials said Reagan would remain highly visible in the next few days. While detailed plans are undetermined, these officials said Reagan would step up his campaign for tax reform and budget cuts in speeches across the country in an attempt to convert his enhanced popularity into tangible legislative progress.

Meanwhile, a senior administration official told reporters that Reagan would redeem his pledge for "swift and effective retribution" against terrorism not by direct retaliation against the hijackers but by launching a campaign against international terrorism. Reagan said in his speech from the Oval Office last night that "the world must unite in taking decisive action against terrorists."

The official said that this campaign may include a request for legislation asking for more resources to combat terrorism and "legal authority to act and to apprehend and to follow, track, identify and detain people."

What began last week as a damage-control strategy to limit backlash against the administration is now being converted into a plan to gain political advantage from the return of the hostages.

Last Thursday, when officials were optimistic about the eventual outcome but still uncertain when the hostages would be returned, a senior White House official told The Washington Post that plans were being drawn for different contingencies.

The official said that it was widely recognized that prolonged holding of the hostages in Lebanon would invite comparisons to President Jimmy Carter's predicament during the Iranian hostage crisis.

On the other hand, he said, if Reagan were successful in winning the release of the hostages he would gain in public standing and use his increased popularity to become a more activist president. The official said that once the hostage crisis was resolved successfully Reagan would "twist the arm of Congress" in an effort to win approval of his economic programs.

Reagan hinted at this Friday, in the same speech in Chicago Heights, Ill., in which his hints at possible reprisal for the hijacking drew criticisms that he may have delayed the hostages' return.

"When Congress gets back to town after summer vacation, I'm heading out into the country -- I'm going to campaign all across the nation throughout the fall for tax fairness," Reagan said. "We're going to take it to the people, and we're going to win one for America."

Whether the euphoria produced by the return of the hostages lasts long enough to give Reagan the tangible benefits his advisers seek remains an open question, officials acknowledge.

When the hostages were seized on June 14, the president's campaign for tax reform, which he had billed as "the second American revolution" in a May speech, appeared to have bogged down. A few days after the hijacking, a senior White House official took comfort from the disappearance of the tax issue from public view by saying that it was fortunate that the measure would not be voted on in Congress at least until the fall.

The flip side of that reasoning now is that it may be difficult for Reagan to gain long-lasting advantage from his popularity of the moment. Reagan advisers say it is too early to tell whether the surge of support for the president during the hostage crisis is temporary or whether it will have lasting impact.

Some Reagan advisers also are skeptical that the public outrage against terrorism will last long. One Republican close to the White House said last week that "the American people are forgiving" and would not long remain supportive of retaliation if the hostages were returned safely.

Reagan's sometimes-restive critics on the right may have longer memories. The president has been under attack on issues ranging from his tax overhaul plan to an endorsement of a Senate version of the defense budget that allows only inflationary growth.

Some advisers believe his most conservative aides will continue to press for deeds of retaliation to back his tough talk against terrorism.

Nonetheless, the prevailing belief in the White House is that the release of the hostages gives a needed boost to Reagan during one of the most difficult periods of his presidency.

"The American people are the ultimate pragmatists," a senior White House official said last week. "No amount of explanation will mean anything if the president doesn't get those hostages out. If he gets them out safely, no matter how, he's going to be a hero again."