Prime Minister Margaret Thatcher Friday described Britain's close relationship with the United States as a pivotal factor in forcing communism's global retreat, and she pledged that Britain would be a strong ally of the next U.S. president.

"President Reagan has rebuilt the strength and confidence of the West - not without a little help - and inspired the democracies to go out and win the battle of ideas," she said. "It is vital that Britain and America should always stand together, so the next president of the United States too will have the United Kingdom as a staunch ally."Addressing an enthusiastic crowd of 2,000 people on the final day of her Conservative Party's annual conference here, the 63-year-old prime minister vowed to carry her capitalist crusade to the heart of Europe as the 12-nation European Community moves toward greater unity by 1992.

"We haven't worked all these years to free Britain from the paralysis of socialism only to see it creep in through the back door of central control and bureaucracy from Brussels," she said. Brussels, the capital of Belgium, is where the European Community has its headquarters.

Thatcher's remarks echoed what she said recently in the course of a tour of European cities, deriding proponents - mainly French and West German - of a united Europe without national boundaries or national identities, administered centrally from Brussels.

"That wasn't what we joined the European Community for," she said Friday.

She emphasized Britain's commitment to closer European cooperation but said that Europe should be "based on the widest possible freedom for enterprise . . ."

She spoke as Western Europe's most experienced, most influential leader, whose capitalist crusade has come to dominate the political agenda of several countries of the European Community.

She is now in her 10th year as prime minister, and her hold on domestic power is stronger than at any time since she took office. She has a firm majority of 101 seats in Parliament, and her opposition has fallen into disarray.

A recent national opinion poll indicated that only 11 percent of Britain's voters believe that Thatcher can lose the next election, which she need not face for another four years.

She saved her toughest language for an assault on terrorism and the IRA. "... This government will never surrender to the IRA," she vowed. "Never."

The IRA campaign of violence is aimed at ending British rule in Northern Ireland, but she said that the terrorist threat to freedom is worldwide, and added: "It can never be met by appeasement. Give in to the terrorist and you breed more terrorism. We will not bargain, nor compromise, nor bend the knee to terrorists."