President Carter yesterday became the first President since John F. Kennedy to visit the National Gallery. He and his wife, Roselynn, were given a private, unannounced tour of the immensely popular, spectacular treasures from the 3,300-year-old tomb of King Tutankhamun.

A handful of dignitaries went with him, including Egyptian Ambassador Ashraf Ghorbal. According to a Gallery official, Carter greeted Ghorbal with a "sincere, heartfelt appreciation" for the ambassador's help in negotiating freedom for 124 hostages held by Hanafi Moslem gunmen earlier this week.

In return, the official said, Ghorbal expressed "his appreciation for having the President come and see King Tut" before the exhibit closes Tuesday.

There were thousands waiting in line to see the exhibit when the President and his party, including national security adviser Zbigniew Brzezinski and scheduling director Tim Kraft, were whisked into the gallery's underground parking lot at 9 a.m., an hour before opening time.

More than 780,000 people have seen the exhibit since it opened in November. Katherine Warwick, the gallery's press officer, said people now start queueing up as early as 4 a.m. with sleeping bags and folding chairs. Carter later told those in line it was worth the wait.

He strolled through the gallery hand-in-hand with his wife. Reporters were not allowed to come along.At one point, standing before the bejeweled gold mask that was made to cover the boy pharoah's mummified head, he said:

"It's really beautiful . . . It's unbelievably beautiful.There's no other way to describe it. The photographs just dont't do it justice."

That particular mask is decorated with colored glass, carnelian, lapis lazuli, quartz, feldspar and obsidian. It has been described as the most spectacular piece in the exhibit.

J. Carter Brown, director of the gallery, escorted the Carter pary through, accomapanied by Ibrahim Nawawy, curator of the King Tut collection at the Cairo Museum, which loaned the exhibit to tour the U.S.

Several times during the hour-long tour, Carter said he'd like to see the thousands of other artifacts still at the Cairo Museum, Warwick said.

"He'd read the catalog to the exhibition before he came. So had Rosalynn," she said. Whey Amy Carter, the President's daughter, saw the exhibit Inauguration week, Brown sent a catalog home with her, along with "an invitation to the Carters to try to come if they could," Warwick said.

The treasures were discovered in 1922 by archeologist Howard Carter after a persistent search of more than six years that seemed, toward the end, that it might have to be called off for lack of funds.

"I'm glad Cousin Howard was so persistent," Carter was reported to have said. "That's why I'm going to claim him as a cousin."

When the President left, just before the scheduled opening time, he chatted with tourists toward the end of the line, who, gallery officials said, had a six-to seven-hour wait ahead of them just to get in.

"It's worth waiting for," Carter told one man. "You won't believe it, it's so beautiful."