Oil billionaire and art entrepreneur Dr. Armand Hammer announced yesterday that his Knoedler Gallery and a Swiss art-investment fund will merge as a $40-million firm aimed specifically at sales among the oil-rich Arabs.

"The Arabs are already into stocks and real estate, and given particularly the depreciation in the stock market, we think they might be attracted by the solider investments in the art market," Dr. Hammer in a telephone interview yesterday. "We've sold a lot already to the Iranians. And we're hopeful about the Arabs."

Dr. Hammer, who is the 78-year-old chairman of Occidental Petroleum and has been a principal middle man in dealings between the Soviet and American governments for more than half a century, said he doubted that there had been a merger of "such substance" in the commercial art world.

The Swiss firm, Modarco S.A. is an unusual institution managed by two banks that started investing in paintings in 1977 with the specific purpose of stooring them away as they appreciate in value, then selling them. "They went in for the long pull," said Hammer. "The values gradually went up while their stocks were traded over the counter in Geneva."

When the world art market softened temporarily in 1975, Modarco suffered a $500,000 loss. But by the most recent appraisals, the firm's worth is up to about $20 million. Hammer said he was approached this summer by one of the firm's managers, Jean-Jacques Michel, President of the Banque de Paris et des Pays-Bas (Suisse), who suggested that the "time had come for a merger."

This would put at the disposal of Modarco, which is purely an investment firm and not a gallery, the extensive marketing facilities of M. Knoedler & Co. which has been in the business since 1946 and has brances in both New York and London.

Acquired by Hammer in 1971, Knoedler's is also appraised at $20 million, so no money would change hands in the merger. Hammer said Modarco has 100,000 to be owned by Knoedler. The company will be named Knoedler-Modarco S.A., with Hammer as chairman and president; Michel "an old friend," would be vice chairman.

According to Hammer, the deal will not be final until the U.S. Internal Revenue Service has agreed that the transaction will be tax-free. "But preliminary indication from the IRS are that it's okay," he added.

As of its most recent annual report, Modarco listed holdings by 32 artists mostly from the late 19th century and the first half of this one. Among the names: Picasso, Braque, Lipshitz, Matisse, Rousseau, Renoir, Toulouse-Lautrec, Monet, Munch, Chagall and nine of the rare Russian Constructivists.

Knoedler's holdings have embraced art. The firm helped build the collect-virtually the entire range of Western tions of Henry Clay Frick, Joesph E. Widener, J.P. Morgan and Andrew Mellon - including Mellon's purchases from Leningrad's Hermitage that formed the nucleus of the National Gallery of Art.

Hammer's involvement in art came relatively late in one of the most swashbuckling, maverick business careers of his times.As a master trader in everything from pencils to boubon to cavier to oil, Dr. Hammer (he is also a physician) has dealt with world leaders from Russia's V.I. Lenin to Libya's Col. Qaddafi. As an added element in this complex career, Dr. Hammer pleaded guilty this year to three dismeneanor counts growing from his part in making $54,000 in illegal campaign contributions to President Nixon's 1972 campaign. He was fined $3,000 and sentenced to a year probation.

But if Dr. Hammer came late to art collecting, he hardly spared himself in making up for lost time. He has willed to the National Gallery of Art $2 million in drwings, including a Rembrandt, a Rapheal and a Durer. Only last fall he paid, $3.25 million for Rembrandt's "Juno" - a record for a Rembrandt. (It will be bequeathed, as well as other oils in his $20-million collection, to the Los Angeles County Museum.)

Also, Dr. Hammer is perhaps the only Western art collector to have given to Soviet museums - a $1-million Goya to the Hermitage in 1972 and a Dufy from his own collection to Moscow's Pushkin Museum the following year. And it was through his ties to Russian leaders that Dr. Hammer arranged the exhibitions here in 1973 and 1975 of masterpieces from Societ museums.