Paul Mellon, 71, has relinquished his position as president and chief executive officer of the National Gallery of Art. He has been replaced by John R. Stevenson, 56, an attorney from the New York law firm that has long been retained by the Mellon family.

Mellon's decision, announced yesterday, marks the closing of an era. Mellon had run the Gallery, founded by his father, since 1963.

His retirement is only partial. He was yesterday elected chairman of the board, replacing in that post Chief Justice Warren E. Burger who, citing judicial duties, had asked to be relieved.

At yesterday's meeting, the Gallery's nine-member board elected its first woman trustee. She is Ruth Carter Johnson of Fort Worth, founder and president of the Amon Carter Museum of Western Art. Mrs. Johnson, who had been national chairman of the Gallery's collector's committee since its formation in 1975, replaces John Hay Whitney, who left the board in January for health reasons.

Mellon, who has not missed a board meeting since 1970, will no longer supervise the Gallery's activities, at least not directly.

When Paul Mellon joined the board in 1938, the Gallery had not yet been opened to the public, but the West Building is now open, the first head of its new Center for Advanced Studies in the Visual Arts will be named Monday, and Mellon's move appears timely. With his sister, the late Ailsa Mellon Bruce, he carried on his father's work, but there is no other family member in sight who has the eye, the drive, the cash to replace Paul Mellon's. When eventually he leaves the board, the museum that the Mellons built, for the first time in its history, will be on its own.

Mellon, one of the wealthiest men in America, has few peers as a collector. In the past two years he's overseen the opening of two remarkable museums, both built with Mellon funds. His Yale Center for British Art, a gift of his alma mater, opened in New Haven in 1977.

The National Gallery of Art, though a national museum, has never bought so much as a minor pencil drawing with government funds. All its paintings and its purchase monies come from private donors. Paul Mellon's sister, the late Mrs. Bruce, was one of the Gallery's most generous providers. She bought for it its Leonardo and helped pay for the West Building. Though Mellon has two children, neither has been very involved in Gallery operations.

Stevenson, the new man in charge, was born in Chicago and educated at Princeton and Columbia Law School. A former legal adviser to the State Department (1969-72) and leader of the U.S. delegation to the Law of the Sea Conference (1973-75), he also is a trustee of the Andrew W. Mellon Foundation. He joined the Gallery's board in 1975. he is with the firm of Sullivan and Cromwell.

Carlisle H. Humelsine, board chairman of both the Colonial Williamsburg Foundation and the National Trust for Historic Preservation, has been a Gallery trustee since 1974. He will serve under John R. Stevenson as the Gallery's vice president.