The invitation read "White tie and decorations" and the guests at the National Gallery of Art last night knew how to follow instructions. Yellow sashes, red ribbons, gleaming gold and silver medallions glittered below the white ties and from the occasional silk or taffeta dress.

But the decorations paled before something even better. Mellon, Whitney, Annenberg, Bruce, Bass, Heinz, Bush -- the guests wore names as weighty and shimmering as the most impressive medals.

All the decorated people had gathered for the bi-annual Andrew W. Mellon Dinner. This year, the dinner was both a cross-section of American power and wealth and a glossy farewell party for Paul Mellon (son of NGA founder Andrew Mellon) as chairman of the gallery's board.

"It's the end of an era in the history of American philanthropy," said director J. Carter Brown, as more than 400 guests arrived to the sounds of strings and the scent of fresh flowers and expensive perfumes.

"Paul's retirement ends one of the most remarkable episodes of American history," said Franklin D. Murphy, chairman and CEO of the Times Mirror Co. and trustee of the Los Angeles County Museum of Art, who will succeed Mellon as chairman. "There are good young collectors, yes, and there will be collectors who will make the effort, but there will never be another Paul Mellon. He's unique."

And, Murphy added, "The times have changed. Money is a little more difficult to come by."

And so is art.

"The younger generations of my family haven't really followed the tradition of collecting," said Peter Dibonaventura, grandson of the late John Hay Whitney, the diplomat, publisher and art collector. "Perhaps later in life. But artwork is so expensive."

Dibonaventura, who works at a sports marketing agency in New York, was escorting his grandmother, Betsey Whitney.

"She's been able to maintain much of the collection at her own home," Dibonaventura said, "which has been a real treat for the rest of the family."

While a uniformed aide stood discreetly nearby, holding Barbara Bush's little red purse, Vice President Bush received guests who included Supreme Court Chief Justice Warren Burger and Justice Sandra Day O'Connor, Secretary of Defense Caspar Weinberger and a smattering of ambassadors and members of Congress. While the line crawled toward Bush, Sen. Claiborne Pell (D-R.I.) walked quickly through an exhibit of paintings by George Stubbs, which opens today in honor of Mellon.

"Such brilliant color and life," he said as he moved from room to room. "I'm looking for the American Wing -- one of the paintings belongs to me, I lend it to the Gallery. It's a Bingham."

And he wandered off in search of his Bingham.

Then it was time for dinner in the rotunda of the West Building, where vines of clematis wound their way up delicate branches in the center of each table and scores of waiters seemed to fly somewhere just above the marble floor. Silver platters of shad roe mousse and lamb floated by, followed by clouds of white spun sugar surrounding orange and raspberry sorbet.

President Reagan appeared on a large screen (sans white tie and decorations -- he opted for a brown suit) and told the guests, "The generosity of so many of you sitting in the rotunda tonight is a glowing example of what the private sector in this land of ours can accomplish."

NGA President John R. Stevenson announced that as of Thursday night, the gallery's campaign to raise a permanent endowment fund for acquisitions had collected $52.8 million.

And then Paul Mellon went to the microphone.

"I remember when this building was a huge hole in the ground, full of Tiber Creek water," he said. His soft voice echoed and ricocheted off the columns and dome of the rotunda. "I say goodbye with great satisfaction, and I have to admit, a little pride. . . It has been a unique privilege to have seen the vision become a reality and grow, and to have been a part of it, as it evolved into what is now a great national asset. . . "

The night was almost over, the era almost ended. Outside, the air was full of the splashing of the gallery's fountains and the quiet voices of chauffeurs chatting with each other as they waited next to scores of sleek, dark limousines.