The National Gallery of Art, long regarded by the public as a rich museum, yesterday disclosed that it is running short of money for buying works of art.

The Gallery, in fact, now has so little cash that if it keeps on buying at the pace of recent years, the money it has set aside for art acquisitions may well be exhausted in 1981.

The Gallery's trustees, who never in the past have discussed cash with candor, yesterday released a detailed description of the Gallery's accounts. In apparent preparation for some sort of national fund-raising campaign, a full financial statement has been appended to the Gallery's annual report for the fiscal year that ended on Sept. 30, 1979.

The Gallery that year spent $3,777,696 buying works of art, leaving only $8.7 million for future acquisitions.

Concerned by the depletion of their acquisition funds, last October the trustees set aside nearly half that sum, about $4 million, leaving only $4.7 million for buying art.

In today's inflated market that is not a lot. A single painting could cost more than that. The Gallery's Leonardo, for example, cost more than $5 million. Last month Norton Simon spent $3.7 million on a single canvas by the Flemish artist Bouts whose name was not a household word before the sale.

"Anything really worthy of the National Gallery is bound to be expensive," its director, Carter Brown, said yesterday. Though in flusher days the Gallery frequently bought pictures with seven-figure price tags, such big acquisitions probably will be rare in the years to come.

In fiscal year 1979, the Gallery was given $18 million by the federal government, though it has never spent such monies buying art. Most of the works it owns came to Washington as gifts; most of those that it has bought were purchased with Mellon family funds.

The Mellons -- Andrew W. Mellon, and his son and daughter, Paul and the late Ailsa Mellon Bruce -- have given more than $100 million to the Gallery. The Gallery's two buildings are among their gifts.

Andrew Mellon, his daughter, and such generous Gallery patrons as Chester Dale, the Wideners, the Kresses and Lessing Rosenwald are no longer living. Paul Mellon, who now is in his 70s, recently resigned the museum's presidency to become chairman of the board. "We won't be able to rely on the Mellons forever," said John R. Stevenson, who replaced Paul Mellon as president of the Gallery. "One family no longer can resolve our problems."

Many private art museums that once seemed self-sufficient -- the Phillips, for example -- are now seeking outside funds. The Gallery, in the future, will almost certainly compete for such monies. "We're releasing all these figures because we want the public to know our situation -- and to see that our financial problems are their problems too," said Stevenson.

"In order to maintain our curators' morale, and in order to make selections that do not reflect the proclivities of a particular individual, we soon will have to raise new acquisition funds," he added.

It costs $23.7 million a year to operate the Gallery Of the $342 million spent there since it opened in 1937, $211 million, or 62 percent, came from private sources. Income from the Gallery's $19 million endowement pays the salaries of its executives and also helps defray the costs of the lavish installations of its special exhibitions. When Brown first joined the staff, annual attendance there was a few hundred thousand; last year there were 5.5 million visitors at the Gallery, according to the annual report.

The Gallery's curators are aware of their museum's plight. Most of them have seen works of art they hoped to buy go to other institutions. "The Getty museum in California has so much money," said one curator, "they have between $30 million and $50 million in interests every year to spend on acquisitions. How can we compete?"

"We must dispel the myth," said one of his colleagues, "that this place is run by rich old men with huge reserves of cash."