LONDON, JULY 3 -- Despite the Reagan administration's distraction over the Iran-contra affair and coming elections, Prime Minister Margaret Thatcher said today, "it is absolutely vital that the United States" urgently addresses key international issues and "shows the kind of leadership which it must if the free world is to thrive and flourish."

Thatcher, who is scheduled to meet with Reagan in Washington on July 17, said she hoped to focus on "taking stock" of U.S.-Soviet arms control negotiations, and on the need for an international conference on the Middle East.

In a lengthy conversation with American journalists here, Thatcher also described the "historic and courageous things happening in the Soviet Union," where she visited last March. While she criticized the Soviets on defense issues and Afghanistan, she spoke with obvious feeling about the need for western support of the new domestic "openness" initiatives of Soviet leader Mikhail Gorbachev.

"We must welcome, and hope that this courageous plan of Mr. Gorbachev's will indeed succeed," she said. "It is not only in the interests, I believe, of the people of the Soviet Union, but it is in the interest of the whole free world."

Thatcher said that Reagan had shown "clear and decisive leadership" over the Persian Gulf. "I believe that what the president has done is right," she said, in reference to the administration's plans to reflag and protect Kuwaiti ships in the gulf.

But, Thatcher said, Britain had played its role "fully and decisively" in the region, where it has maintained a naval presence escorting British shipping for the past six years, and could not allocate more resources there. Referring to calls from some U.S. legislators for greater European support of the administration initiative, Thatcher said, "I don't see how they can possibly have any criticism of us, nor of the amount we put into the defense of the free world."

Three weeks into her historic third term in office, Thatcher was talkative and appeared in good humor. Welcoming American journalists to her office and residence at No. 10 Downing St., she referred to the two countries' common heritage and said, "This house is as much your inheritance as it is mine. We made one very bad decision here. We quarreled with the American colonies.

"It wouldn't have happened if they had had a woman prime minister at the time. But there you are."

Asked the purpose of her one-day trip to Washington, Thatcher said it was "to demonstrate once again the commitment of this country to the Atlantic relationship between the United States and the United Kingdom." Following her reelection to another five-year term, she said, she thought she "should go and talk matters over with the president."

Thatcher declined to assess the president's current status in Washington in light of continuing revelations in the Iran-contra affair, or to comment on reports that Reagan appears increasingly disengaged from administration decision-making.

She said that in their talks during the Venice summit in early June, Reagan "took a very full part," but noted that she had left the meeting early to return to the electoral campaign here.

But Thatcher made clear her concern that issues she considers crucial need to be "moved on" by the administration. During today's session, she made repeated reference to "really big issues at the moment," and her desire for the United States to assert leadership and avoid losing opportunities.

Throughout her long and close relationship with Reagan, Thatcher has seen her role as preserving the "specialness" of ties between Britain and the United States, and helping the president to clarify his international goals in the context of allied concerns.

Officials in her government make frequent reference to her last two trips to Washington. In late 1984, she met with Reagan at Camp David to discuss the European belief that research and development of the administration's Strategic Defense Initiative should not violate the U.S.-Soviet Anti-Ballistic Missile Treaty, and insistence on allied consultation over the program. She emerged with a document Britain considers to constitute administration agreement.

Last November, she met again with Reagan at Camp David, to voice concern over the broad scope of disarmament he had discussed with Gorbachev at the Reykjavik summit. That time, Thatcher emerged with a more circumscribed arms negotiation outline that ever since has formed the basis for the western position.

A well-informed official here said this week that Thatcher's current purpose in traveling to Washington is to head off possible administration stumbles on a major international issue, and to press for movement in key areas.

At the top of the list are East-West relations and arms control. The proposals on the table at Geneva for eliminating medium-range nuclear missiles are good ones, Thatcher said. But she implied that she also wants to make sure the administration is focused on the simultaneous need for progress on reductions in chemical weapons and conventional forces.

Thatcher said she hopes for both an arms control agreement and a Reagan-Gorbachev summit this year. Both, she said, "would reaffirm the leadership of the United States, as well as the authority of the president . . . . I cannot overstress how important it is that the authority and leadership of the United States . . . should continue to flourish."

She said she had no particular message to carry to Reagan from Gorbachev, with whom she held extensive meetings in Moscow in March. But Thatcher said the "relationship of ease of communication and frank communication" between her and the Soviet leader was "very, very valuable."

Thatcher is expected to press Reagan to put the United States' weight more firmly and publicly behind an international conference to work toward resolving the Arab-Israeli dispute. She discussed the issue at length during a visit here two weeks ago by Israeli Foreign Minister Shimon Peres, whose support for the conference is not shared by Israel's prime minister, Yitzhak Shamir.

According to diplomatic sources here, U.S. reservations have centered on a disinclination to include the Soviet Union, as well as Arab states accused of supporting terrorism, in such a conference.

One player seen as crucial is Syria, with which the United States and Western Europe have had strained relations. Last fall, Britain broke relations with Syria following the conviction of a Palestinian here of trying to blow up an Israeli airliner with Syrian government assistance. But officials here have said that recent moves by Damascus against known terrorist agents have persuaded London to lift at least one restriction -- that prohibiting high-level diplomatic contacts with Syria.

Thatcher described the international conference as a "framework" for talks between Israel and Arab and Palestinian representatives. "It's not anything that could be a mediator, or have a veto," she said.