The National Gallery of Art is losing its second-in-command. John Wilmerding, its deputy director, will leave Sept. 1 to take a new, endowed professorship at Princeton University.

News of his appointment -- announced by Princeton Sunday -- evoked expressions of dismay yesterday from his curatorial colleagues and other members of the staff.

"We're all very upset about it," said Ruth Kaplan, the gallery's information officer.

What makes his departure even more painful is that, as part of his Princeton duties, Wilmerding will become an unpaid guest curator at the gallery's archcompetitor -- the Metropolitan Museum of Art.

National GalleryDirector J. Carter Brown said yesterday that no successor had been chosen. "We'll start working on that tomorrow." He added, "John and I have had a wonderful relationship. Whenever I was away from the gallery, and I was away often, I could feel that it was in marvelous hands. I had a hard enough time luring him away from academia to be entirely surprised at his decision to return."

Wilmerding's departure, for a variety of reasons, is generally regarded as a major blow to the museum. For one thing, he'd been viewed for years as the logical successor to its director, Carter Brown.

Wilmerding, 49, yesterday laughingly denied he ever had hoped to get the post. "Carter, after all, is immortal and immovable," he said. "I told him when I took the deputy director's job that I wasn't waiting around to replace him, and I meant it." But there is no doubt that Wilmerding has all the right credentials, social and professional, for the director's job.

He is the most widely respected specialist in American art history on the gallery's staff. He is author or coauthor of more than a dozen books, among them "A History of American Marine Painting" and the volume on American art in the Pelican "History of Art" series. As a curator he has mounted such popular exhibitions as "American Light" (1980), a John F. Peto retrospective (1983) and what he now calls "the infamous Helga show" of Andrew Wyeth's portraits, which opened here last year. As deputy director, a post he assumed in 1983 after six years as curator of American art and senior curator, Wilmerding has proved himself a skillful administrator of the gallery's professional departments.

His unwavering kindness and exceptional candor have made him popular. "Top men in top museums are often snooty, self-important guys," said one gallery employee yesterday. "John is not like that at all. He never lords it over underlings. He doesn't take himself too seriously. And he's got a wonderful eye."

Princeton has raised $1.25 million to endow Wilmerding's professorship. Much of the money has provided by Louisa and Fayez Sarofim of Houston, and the professorship has been named for their son, Christopher Binyon Sarofim, a 1986 Princeton graduate.

Princeton is renovating and nearly doubling the size of its art gallery. The Met, meanwhile, is preparing to open its new Henry R. Luce Center for the Study of American Art, which will place in open view the 12,000 American objects in its reserve collection. Princeton students require works of art to study ("I didn't want to return to the darkness and start playing with colored slides," said Wilmerding); the Met wants teams of scholars to explore its remarkable collections; and Wilmerding has been chosen as the man to guide them.

Though a Princeton press release says its new professor "will inaugurate a new cooperative program" between the university and the Metropolitan Museum, Wilmerding said yesterday that details of the relationship have yet to be resolved.

Philippe de Montebello, director of the Met, said he was "delighted" at Wilmerding's decision. The move, he said, will be "good for him and for us at the Met, and a major step for American art. We're thrilled."

Wilmerding has always been a dedicated pedagogue. You can see that in his film scripts and his writings, his lectures and his shows. He taught for 11 years at Dartmouth before joining the National Gallery in 1977. "You can't be a full-time curator and a full-time administrator," Wilmerding said. "And if you try to do both jobs, you don't have time to teach. That's the only reason I'm leaving. It's my love of teaching that made me take the job."

In the winter of 1986, Wilmerding spent three weeks teaching as an Oates Fellow at Princeton. "That planted the seed," he said.

Wilmerding, who was born in Boston, attended St. Paul's School before attending Harvard, where he earned his bachelor's, master's and PhD.

As deputy director, he has been responsible for supervising the National Gallery's curatorial departments, the library, the conservation laboratory, the education department, loans and exhibitions, the Index of American Design, the systematic catalogue and many other behind-the-scenes aspects of the museum.

Despite these heavy duties, Wilmerding has left his mark on numerous recent shows. He has contributed to the current display of American folk art from the Shelburne Museum, an institution founded by his grandmother, Electra Havemeyer Webb.

Wilmerding said the gallery has "an exceptionally strong program in American art history. I promise you Nick Cikovksy and Frank Kelly will do a first-rate job without me." He said exhibitions of the works of American painters John Marin, Frederick Edwin Church, Raphaelle Peale and Albert Bierstadt are being planned.

Wilmerding is writing an essay for the catalogue of the Peale still life show, which will open here this summer. His last major gallery show, a survey of the marine paintings of Fitz Hugh Lane (1804-1865), opens May 15. "After 11 years in academia, and 11 years at an art museum, the Fitz Hugh Lane exhibit will close the circle nicely," he said. "He was the subject of my first book."