The former luxury apartment building where Andrew Mellon lived and where he bought the nucleus of the National Gallery of Art collection was sold yesterday to the National Trust for Historic Preservation for its new headquarters.

The beaux arts building, completed in 1917, is at 1785 Massachusetts Ave. NW. Brookings Institute, next door, sold the building for $1.34 million, trust president James Biddle announced yesterday. Brookings has owned the six-story builking, now used as offices, since 1970. It is listed on the National register of Historic places.

It was there that Lord Joseph Duveen, an international art dealer, persuaded Mellon by a ruse to buy the major art works which became the core of the National Gallery.

According to S.N. Behrman in his book, "Duveen," Duveen sold Mellon on the idea of a National Gallery of Art, and proceeded to provide him with the art objects for it all at a handsome profit to Deveen, of course.

In 1936, Duveen persuaded the family living in the apartment below Mellon to sublease to him. He then hung a magnificent collection of art in the apartment and added the appropriate furniture! He installed a caretaker and guards, delviered the key to Mellon and departed to New York on other business.

Behrman continues:

"Meanwhile, Duveen kept in touch with his caretaker in Washington. The caretaker confided charming vignettes of the tenant on the upper floor, in dressing-gown and carpet slippers, leaving his own and apartment to bask in Duveen's more opulent environment. Sometimes the caretaker reported, Mellon found it more agreeable to entertain guests in Duveen's place than in his own.

"Gradually, Mellon must have begun to feel that the paintings he showed off to his friends as Duveen's when he felt he couldn't go on living a double life. He sent for Duveen and bought the contents of his apartment, lock, stock and barrel. This was the largest transaction ever consumnated in the world of art.

There were 42 items for which Mellon paid $21 million. This purchase provided the caor of the collection which became the National Gallery of Art.

Mellon occupied the fifth-floor apartment from 1922 until his death in 1937. During that time he served as Secretary of the treasury under presidents Harding, Coolidge and Hoover, then became ambassador to Great Britain.

He was not the only famous occupant of the grand old buikling. Perle Mesta, the famous Washington "hostess with the mostest," lived in one of the first-floor apartments! During the '20s and '30s, the tenants uncluded Robert Woods Bliss, an ambassador and art collector who donated his Dumbarton Oaks estate to Harvard Universtiy; Sumner Wells, former under secretary of state and Alanson B. Houghton, ambassador to Great Britain and Germany and president of Corning Glass Works.

The apartment building offered its tenants what might be described as mansions in layers. There were only six apartments in the entire building: two on the first floor (which also had service areas in the basement) and one each on the upper floors.

Each of the upper apartments had 12 major rooms, including coat closets for men and women guests. The drawing rooms wer 24-by-45 feet and more than 14 feet high. Each apartment had 10 fireplaces.

There were five smaller servants' rooms for each apartment. Every apartment had its own silver safe and wine closet. The building had one of the city's first central vacuum systems. The refrigerators for the apartments were run by a central chilling unit in the basement.

The grand lobby is round with a semi-domed ceiling, elaborate moldings and a white marble staircase.

Jules Henri de Sibour, who claimed descent from Louis XVI, designed the building for Stanley McCormick, son of the man who involved the veaper. De Sibour also was architect for a number of embassies, here including the French embassy.

The trust has commissioned David Yerkes and Assoc. Architects (Nicholas Pappas as partner-in-charge) to remodel the building at an estimated cost of $1.6 million. The trust will occupy the lower floors and rent out the upper. The Stephen Decatur house on Lafayette Square will continue to be maintained by the trust as a house museum and will be used for conferences.

"The building in general, especially outside, is in good condition," Pappas said yesterday. "Inside we will have to replace some of the architectural embellishments, filling in where som of the plasterwork has been lost. The building was wonderfully built with a limestone exterior and a slate mansard roof."

Trust president Biddle pointed out that in buying the handsome, historic structure for trust headquarters, the trust is "practicing what we preach." And all Washington history and architecture buffs can be grateful that the trust chose to buy the Mellon apartments, instead ofbuilding another glass box. CAPTION: Picture 1, The entrance lobby of 1785 Massachusetts Ave., where Andrew Mellon once lived. The building was bought yesterday by the National Trust for Historic Preservation; Picture 3, The beaux arts building, which was sold for $1.34 million, and, one of the former dining rooms. Originally used as a luxury apartment building, it has, since 1970, housed offices of the Brookings Institute. Photo by James A. Thresher - The Washington Post, by the National Trust for Historic Preservation; Picture 3, no caption.