A political controversy over Prime Minister Margaret Thatcher's refusal to impose sanctions against South Africa threatened today to boil over into one of the most sacred areas of public life here, the role of Queen Elizabeth II as British head of state and leader of the 49-member Commonwealth.

The queen, having presided during her 34-year rule over the evolution of the Commonwealth from a collection of British colonies into a community of staunchly independent nations, now faces the prospect of reigning over what some say may be its demise.

London awoke this morning to newspapers awash with rumors that the queen was displeased with the escalating controversy that has pitted Thatcher alone against the majority of Britain's former dependencies who are clamoring for sanctions.

According to widespread press reports, attributed to unnamed senior Cabinet members who purportedly are concerned over Thatcher's highly visible intransigence, Elizabeth has communicated her displeasure to the prime minister during the regular Tuesday evening meetings when the two women sit alone to discuss the week's events.

Buckingham Palace -- normally eager to disclaim any political interference on the part of the monarch -- has avoided all comment on the reports.

The queen seemed unconcerned today when she appeared in the city's East End to open a new public building. She smiled benignly as a crowd of well-wishers honored her with an impromptu chorus of "I'm Forever Blowing Bubbles," the theme song of the neighborhood soccer team.

But Elizabeth is known to take her Commonwealth role seriously. And while many Britons profess to consider the Commonwealth little more than a useless vestige of empire that is more trouble than it is worth, they often react strongly on the queen's behalf when they think she is troubled.

Senior politicians in Thatcher's Conservative Party are known to be concerned that opposing sides in the sanctions debate will seek to invoke the queen's name, giving rise to public unease and domestic political problems.

In an apparent attempt to signal some moderation of the government's heretofore implacable opposition to comprehensive sanctions, Foreign Secretary Geoffrey Howe told the House of Commons this afternoon that if his upcoming mission to South Africa "does not procure tangible and substantial progress . . . I would regard agreement on some further measures" against Pretoria "as likely to be necessary."

Howe, who arrives in Washington Thursday for talks with the Reagan administration on South Africa, declined to specify what measures Thatcher and her government might be willing to consider.

The controversy already has wreaked havoc on the quadrennial Commonwealth Games, which the queen is to open next week in Edinburgh. Malaysia today became the sixth nation to announce a boycott of the event in protest against Thatcher's stand.

Several heads of Commonwealth governments, most prominently Zambian President Kenneth Kaunda, have threatened to withdraw from the community if Britain, its premier member, does not bend to the will of the majority of its former dependents.

In an often bitter parliamentary debate this afternoon, opposition Labor Party spokesman Denis Healy charged that Thatcher had "already wrecked the Commonwealth Games . . . . But what is more serious, you now risk wrecking the Commonwealth as well, and creating a constitutional crisis of major dimensions which involves the palace itself."

The role of the monarchy in Britain's political life has been a sensitive issue throughout modern history. The queen serves as head of state but is not head of the government. Her role was described in Walter Bagehot's "The English Constitution," written 119 years ago but still considered the bible of behavior by the royal family.

"The sovereign has, under a constitutional monarchy such as ours, three rights," Bagehot wrote. "The right to be consulted, the right to encourage, the right to warn. And a king of great sense and sagacity would want no others."

In substantive terms, the monarch has only one vestigial power -- to decide which party leader should be called upon to head a new government in the event there is no clear winner in an election.

Elizabeth has had several reported run-ins with Thatcher, most memorably over her decision to attend the 1979 Commonwealth summit in Lusaka, Zambia, despite reported advice from Thatcher that it was too dangerous a trip because of racial troubles then occurring in white-ruled Rhodesia.

It was at that summit that the negotiations eventually ending racial separation in Rhodesia, now Zimbabwe, got started.

The queen has gotten into hot water with constitutional purists on several occasions -- in 1984, for instance, during a visit to Jordan, when she was accused of meddling in politics after remarking on "the tragedy which has befallen the Palestinian people."