Inside a steamy tent filled with ambassadors and activists, socialites and corporate moguls, President Reagan received boos along with the applause last night when he called for an expansion in testing for exposure to the AIDS virus.

"It is time we knew exactly what we are facing," Reagan said in his first major speech on AIDS before guests at a fundraiser for the American Foundation for AIDS Research (AmFAR). "And that is why I support routine testing."

Outside, on the banks of the Potomac River, about 300 people, some of whom have AIDS, stood vigil, holding burning candles above their heads in memory of those who have already died of the disease, and decrying what they see as the Reagan administration's lack of sensitivity and action on AIDS.

As the sun set, the group sang "Amazing Grace" and then began a slow walk to the Potomac restaurant in Washington Harbour, where the fundraiser was held, shouting in support of increased funding for AIDS research. Guests inside the tent could hear the rumble of voices, but the words were lost.

After Reagan spoke, actress Elizabeth Taylor, AmFAR national chairwoman, stood to thank the president and first lady for attending.

"I know there are some people who disagree -- that was quite clear," Taylor said. "But I think what the president said was quite in concurrence with what we all hope and pray for -- that there is a cure for AIDS."

While the president did not ask for "mandatory" testing, as some in attendance feared he would, he spoke in support of "routine" testing of federal prisoners, immigrants and marriage license applicants. After Reagan left, AmFAR President Mervyn F. Silverman carefully explained AmFAR's position in favor of "voluntary confidential testing, accompanied by intensive counseling."

Earlier, Silverman told the crowd of about 850 that "the necessary information {about AIDS} has not been provided because of the lack of funds or the useless debate over who should be educated and what they should be told."

When the AmFAR benefit was first announced, controversy and protest seemed unlikely. Taylor's name was at the top of the invitation. Portions of the proceeds were slated for the District's Whitman-Walker Clinic and RAP Inc. Close Reagan friend Nancy Reynolds and Democratic stalwart Robert Strauss signed up as dinner cochairs, and New York Life Insurance Co. Chairman Donald Ross said the company would pay all the costs of the event. AmFAR decided to give awards to U.S. Surgeon General C. Everett Koop, Dr. Robert Gallo of the National Cancer Institute and Dr. Luc Montagnier of the Pasteur Institute in Paris. Roberta Flack and Marvin Hamlisch were enlisted to provide after-dinner entertainment.

Tickets, ranging from $250 for a seat to $25,000 for a table, sold out quickly, and the limit of 850 guests left many ticket seekers disappointed.

But the testing controversy intervened, and questions about what the president would say came close to overshadowing the awards to be bestowed and much-needed funds to be raised.

In his thank-you speech, Koop, who opposes mandatory testing and has become something of a hero in the AIDS community for his outspoken positions, seemed to take pains to avoid the subject of testing. But Taylor's glowing introduction brought him a standing ovation and perhaps the warmest round of applause of the evening.

A number of guests had discussed whether they should mount some sort of protest inside the tent if the president emphasized testing over education and research. There had been talk of a walkout should the president call for mandatory testing, but at an AmFAR board meeting dinner organizers decided against any strong signs of dissent.

"The booing did not come from AmFAR people," said board member Abigail Van Buren. "We decided no matter what he said, he was a guest at our house and we would treat him that way. I was delighted by what he had to say. In fact, I was embarrassed when the people booed."

Mathilde Krim, one of AmFAR's founders, said that when the group asked Reagan to speak, "the testing issue was not what it is today. The president {was} invited because he is the president and our only president, whether we like it or not. He has the ability to get things moving, and in the whole AIDS crisis what is missing most is leadership."

The dinner crowd included some of the most outspoken organizers and writers dealing with AIDS.

Playwright William Hoffman, author of "As Is," said the call for increased testing "is dangerous because it gives people the illusion they're doing something when they're not. Instead of asking people to do something about their sex lives, they're testing ... And the precedent is dangerous. It opens the door to all kinds of things. Once you have a national AIDS register, this could mean ruined lives, lost jobs."

Dr. Ruth Westheimer arrived on the arm of hairdresser Robin Weir, who had whisked her off earlier for a first-time visit to the White House while he gave Nancy Reagan's hair a pre-fundraiser comb-out. Westheimer had flown in yesterday from West Germany, where she was meeting with health officials to start a UNICEF-sponsored fund-raising campaign for children with AIDS.

"What I'm pleased about is that we're all together," she said. "I think it's a historic moment." But she did express concern over testing. "Who would see the results of that test?" she asked.

Potomac restaurant, never an austere place, was filled with red and pink flowers; dinner included veal and asparagus and a dessert described as "Florentine nests with vanilla ice cream."

Model Beverly Johnson, Elizabeth Taylor and others wore the sorts of outfits camera-toting fans outside were waiting for, the former in a black and white bandeau outfit, the latter in fuchsia and gems. But with tall candles burning on the dinner tables, the sense of solidarity with the vigil outside was strong. Speaking before the president, Krim said, "Thousands of candles are flickering in the night outside this tent asking the question 'When?' The answer to those who stand outside depends on our national will."

Lorien Laureano of Houston was one of those outside. "I am Puerto Rican," he told the vigil crowd. "I am Catholic. I am gay. And I am also a PWA -- a person with AIDS. I have seen too many of my friends die in Houston. Where is my church? Where is my government?"

Laureano and others urged those gathered to participate in today's march to the White House, scheduled to coincide with the opening of the Third International Conference on AIDS here.

"We don't want to come out of the conference with people saying, 'Look at everything the federal government is doing,' because they're not doing enough," said Lori Behrman, spokeswoman for New York's Gay Men's Health Crisis Center. "For Ronald Reagan to say they're doing all they can do is false."

The potential conflicts kept few away from signing up for the dinner, organizers said. Whitman-Walker affiliates purchased a dozen tables, and the guest list included White House Chief of Staff Howard Baker, George Hamilton, Mayor Marion Barry, Malcolm Forbes, Jonas Salk, Abe Pollin, playwright Larry Kramer, Orion Pictures Chairman Arthur Krim, Sen. Paul Simon (D-Ill.), Rep. Henry Waxman (D-Calif.) and Ohio Gov. Richard Celeste.

But at least one likely dinner guest chose to stay outside. Jeffrey Levi, executive director of the National Gay and Lesbian Task Force, took part in the vigil rather than the dinner.

"I think it is more important," he said, "to be memorializing all those who have died of AIDS, with PWAs who will be outside, rather than validating a president who, so far at least, has failed to see the depth of this crisis or the humanity of this crisis."

Vigil organizer Stephen Beck, executive director of the Washington-based National Coalition for PWAs, said the vigil should be seen as a memorial, not a protest.

"People with money, let's call them the elite, can go to dinner and they can feel comfortable thinking about AIDS as an issue," he said. "What we're trying to demonstrate is that when we're talking about AIDS, we're talking about people."

Along with the proceeds of the dinner, last night's event brought in an extra $1 million, donated by Japanese philanthropist Ryoichi Sasakawa, chairman of the Japan Shipbuilding Industry Foundation. The 88-year-old Sasakawa has previously contributed more than $16 million to the World Health Organization, and in the last 25 years his foundation has given more than $12 billion to charities around the world.

Sasakawa first learned of AIDS from the WHO director general, and soon after was approached by AmFAR. "I have brought a humble sum of $1 million," he said to the crowd. Earlier in the day he explained that he was especially interested in contributing because he had heard in Japan that President Reagan's "interest in fighting against AIDS is substantial." Sasakawa said he hoped to speak to Reagan about AIDS, and also about U.S.-Japanese trade problems.

When Sasakawa presented his check to Taylor, she momentarily slid it inside the bosom of her dress before handing it over to Silverman, much to the delight of the audience. Forbes, who recently gave Taylor a similar donation, then joined the group on stage, and Taylor called out, "My million-dollar babies!"

New York Life's cost of underwriting the dinner is expected to be about $50,000. "We're probably more aware than many people in the business world about what this is," said George Trapp, a vice president of the insurance company.

The District of Columbia passed a law earlier this year barring insurance companies from testing applicants for health and life insurance for exposure to the AIDS virus. The law was vigorously opposed by the insurance industry, and many companies have stopped writing new individual life insurance policies in the District because of it.

"We really need to do something positive," said Trapp, "so we're looking at different contributions we could make in research and other proactive things."

The event also marked a public rapprochement between two world-famous virologists who had been embroiled in a feud over credit for discovering the AIDS virus.

When Gallo received his award, he praised Montagnier "for making major headways," and Montagnier in turn called for intensive collaboration between the NIH and the Pasteur Institute. This April, Reagan and French Prime Minister Jacques Chirac reached an agreement assigning each equal credit for discovery of the AIDS virus and the test to detect it.