The resignation of Justice Potter Stewart has provided President Reagan with a rare political opportunity that one White House official said could also become "a real headache" for the administration.

The opportunity is Reagan's chance to put a woman justice on the Supreme Court for the first time in U.S. history. The "headache" could come from the maneuvering within Reagan's administration for the post and also from the negative political repercussions that could result from the appearance of abandoning a campaign pledge to name a woman to the high court.

Reagan announced yesterday through his principal deputy press secretary, Larry Speakes, that he would use a standard of "excellence, competence and judicial temperament" in selecting a replacement for Stewart. Speakes said the president does not seek a justice who agrees with him on everything but wants one who holds to the "key view" that "the role of the courts is to interpret the law, not to enact new law by judicial fiat."

Asked later during a tour of White House basement offices what he meant by that, Reagan replied: "I'm a constitutionalist."

This conservative standard would apply to the three nominees within the administration who are believed to have the best chance of selection if Reagan chooses to nominate someone he knows very well and trusts personally. These are Attorney General William French Smith, 63, who is playing the lead role in the selection process, White House counselor Edwin Meese III, 49, and Deputy Secretary of State William P. Clark, 49.

The naming of any one of them would open Reagan to charges of cronyism, particularly Smith, who headed the presidential transition team and wound up picking himself as attorney general. And Reagan would miss the presence of Meese, on whom he relies heavily for counsel. Some White House officials say that Clark, whose California State Supreme Court service gives him the best judicial qualifications of any insider, would be missed equally because he has played a vital role in easing tensions between the White House staff and Secretary of State Alexander M. Haig Jr.

To several of Reagan's strategists, the idea of naming a woman to the court has particular allure.

Though Reagan has not actually promised to name a woman to the first vacancy of the court, he left a deliberate impression with a carefully worded campaign statement in Los Angeles last Oct. 14. ". . . one of the first Supreme Court vacancies in my administration will be filled by the most qualified woman I can find, one who meets the high standards I demand for all my appointments," Reagan said.

The statement was reread to reporters in the White House yesterday by Speakes, who left the impression that Reagan wasn't making any special effort to find a woman for the court. Later, other White House officials sought to combat this impression by saying that a list of "qualified women" was being prepared at Smith's direction.

The White House officials declined to say who was on the list. But any prospective judicial list for a Republican president has at or near the top of it the name of Cornelia Kennedy of Detroit, a 58-year-old member of the 6 th U.S. Circuit Court of Appeals who is thought to be an impeccable Republican and especially conservative on law-and-order issues.

Criminal justice issues are especially important to Reagan, and he is sensitive because of past experience on this score. As governor, he named a Bar Association choice, Donald Wright, as chief justice of the California Supreme Court and watched with dismay as Wright became the swing vote striking down the capital punishment statute Reagan favored.

Any list of prospective woman appointees is also likely to include Judge Mildred Lillie, a 65-year-old California appellate court member; Sylvia Bacon, a 49-year-old District of Columbia Superior Court Judge, and Rita Hauser, a 46-year-old New York lawyer.

When the president was asked about the court appointment he said there would "be an announcement shortly." Was he looking specifically for a woman? a reporter asked. "Always," Reagan replied.