Secretary of State George P. Shultz sharply criticized meddling by members of Congress in U.S. policy toward Nicaragua yesterday morning, but reversed course in the afternoon when faced with irate lawmakers.

Addressing an American Bar Association conference on restoring bipartisanship in foreign affairs, Shultz declared that "we cannot conduct a successful policy" toward Nicaragua when legislators "take trips or write 'Dear Commandante' letters with the aim of negotiating as self-appointed emissaries to the communist regime."

Five hours later on Capitol Hill, Shultz was challenged in a previously scheduled closed-door meeting by three of the eight House Democrats who wrote a well-known "Dear Commandante" letter to Nicaraguan leader Daniel Ortega March 20, 1984. The letter, which has been attacked by Republicans in congressional debate, appealed to Ortega to permit "truly free and open elections" in Nicaragua.

Afterwards Shultz posed for pictures with the three Democrats -- House Majority Leader James C. Wright Jr. (Tex.), Rep. Stephen J. Solarz (N.Y.) and Rep. Robert G. Torricelli (N.Y.) -- and announced to reporters that "any phrase that might be interpreted as criticism of one of these gentlemen or their associates is not a proper interpretation because I think they have conducted themselves in the spirit of a bipartisan foreign policy."

"A difficult situation was defused," said Torricelli, who called the letter to Ortega "close to a restatement of administration policy."

Shultz, while seeming to exonerate the authors of the letter to Ortega, continued to describe congressional maneuvering with foreign governments as "a real problem." He softened his earlier criticism by saying lawmakers have seemed to be engaging in negotiations with foreign governments "perhaps without even realizing it . . . not necessarily malicious in any way."

Two Democratic senators who made a highly publicized trip to Managua last month, and who evidently felt that Shultz's criticism applied to them, fired back in public statements.

Sen. Tom Harkin (Iowa) charged Shultz with practicing "international McCarthyism" and with attempting "to intimidate the Congress and stifle public debate on the issue of Nicaragua." Sen. John Kerry (Mass.), who traveled with Harkin, said, "We did not negotiate nor has any senator I know of . . . nor is it appropriate to negotiate with the head of a foreign state."

Led by President Reagan, who pounded the table in anger in a meeting with lawmakers Monday, the administration has expressed growing frustration with the congressionally imposed ban on U.S. aid to antigovernment contras, or counterrevolutionaries, fighting in Nicaragua.

Shultz, urging a resumption of aid to the contras, charged in his address yesterday that those who have cut off aid "are hastening the day when the threat will grow and when we will be faced with an agonizing choice about the use of American combat troops."

Chairman Dante B. Fascell (D-Fla.) of the House Foreign Affairs Committee, who succeeded Shultz at the rostrum of the conference, said that "every secretary of state is always bemoaning the fact that he has to deal with 535 secretaries of state in the Congress."

Fascell said the criticism translates into, "Why are you guys arguing with what we are trying to do?" But he added that no U.S. policy abroad can succeed unless "it's fully understood by the American people and the Congress."