What the National Gallery had in mind for visiting Italian President Sandro Pertini yesterday afternoon was a nice, quiet tour of some of the finest art in the world. What it got was a tour that Fellini might have conceived: more than 40 well-tailored members of the Italian press along with American press, diplomats and Secret Service agents who engulfed the tiny 85-year-old president as he made his way through the museum while a U.S. State Department protocol officer shouted directions in Italian.

Pertini loved every minute of it. The museum staff, surprised at first, had fun, too.

It started when Pertini, taking a break from his diplomatic agenda, arrived at the West Building of the museum to sign the guest book in a second floor foyer. Seeing the mob of press behind velvet ropes, he beamed and waved. That was it. They surged forth. "Ciao!" Pertini exclaimed to Italian journalist Aniello Coppola. The two began chatting away in Italian as Pertini walked into one room of paintings. "Everybody come on in!" Pertini announced in Italian to the group.

"No, Mr. President!" said Mary Masserini, State Department protocol press officer, who kept crying out "L'estampa, l'estampa . . ." (press) as she tried to keep unauthorized reporters from following. But Pertini wouldn't have it. Masserini and Pertini conferred. "I was once a journalist and I know what it was like," he said in Italian. "Everyone has to make a living." A round of applause came from the group. The tour continued.

They took a 30-second look at Ghirlandaio's "Madonna and Child." "Okay, andiamo!" shouted Masserini and they moved on.

Pertini paused for a while in front of Rembrandt's "Girl With a Broom," conversing intently in Italian with another journalist, Ugo Stillo, whom the president had greeted warmly with a kiss to each cheek. Where was J. Carter Brown, director of the National Gallery, who usually leads these VIP tours? He was stuck several rows of people back, craning to see over heads.

"This is Cuyp!" shouted Brown as Pertini passed another painting. "Aelbert Cuyp!"

In between pictures and gallery rooms, Pertini held impromptu press conferences in Italian, touching on issues such as Italian-American relations and what he thought of America. (He said he was impressed, someone translated.) And after one of Mary Masserini's shouted directions, he was translated as saying, "They should put this little lady in the Secret Service. She knows everything."

Both Carter Brown and David Brown, the gallery's curator of Italian painting, spoke in Italian about the artworks, but in the tour of French Impressionists, Pertini gave the art lectures. He held forth at some length in front of a Gauguin painting of Tahiti.

"I have to admire Gauguin's courage," came the translation of Pertini's words. "He was tired of the world and left it for a remote, faraway place." He also talked about Gauguin's use of color and mentioned the beautiful women.

"This is a ball," said Carter Brown. "I just love it. There's such a sense of joy." As the group rushed from one room, Brown called out, "A sinistra!" (To your left).

When Pertini saw something that caught his eye, he wandered over to take a look, whether or not it was on the tour that the gallery had mapped for him. He took an unplanned tour of the Rodin exhibit and stopped at Rodin's towering sculpture of Lafayette. "When American troops went to Paris in World War I," said Pertini, himself a Resistance hero in World War II, "they went to Lafayette's tomb and told the French people, 'You came to help our country in its Revolutionary War. Now we're here to help you.' "

"He's very knowledgeable," David Brown remarked.

"Presidente Lincoln," Carter Brown said, pointing to a sculpture. Pertini said he had always admired Lincoln.

They went on to Paul Klee, Edvard Munch, sculptor David Smith, Joan Miro'. "When I was visiting Spain as a head of state, I asked to visit Miro'," Pertini told Carter Brown. "We got along so well that he gave me a painting."

"Well," replied Carter Brown with a chuckle, "you're obviously very good at acquiring works of art. You should be a museum director."

"Yes," said Pertini, "but I don't know if I'm going to give the painting to you."

When it was time to leave, Pertini thanked Carter Brown and beckoned to a journalist friend in the crowd to wish him a personal goodbye.

"One thing we were told," Carolyn Engel, the gallery's deputy information officer, said later, "was that this gentleman is very unpredictable."