THE SOVIET UNION, in an unintentional program of aid to the United States, has been adding to this country's supply of top-level mathematicians.

In the last 10 years, more than 40 distinguished Soviet mathematicians have emigrated to the United States and are teaching at leading universities here. Most of them are victims of official anti-Semitism, which is reported to be particularly prevalent in the Soviet mathematics establishment.

These facts were reported last week by Dr. Melvyn B. Nathanson, dean of the graduate school of Rutgers University in Newark. In 1973, Dr. Nathanson, who has written on Soviet dissidents and translated Russian mathematics-related essays, became the first American mathematician to spend a year at Moscow State University under the auspices of the International Research and Exchange Board.

He compares the Soviet mathematical ''brain drain'' to the exodus of scientists from Nazi Germany. In addition to the United States, he said, France and Israel are major beneficiaries of the Soviet exodus.

Why the Russians, who are known to put great stress on mathematics teaching, have let so many leading mathematicians leave, Dr. Nathanson said, is ''something of a mystery.'' One reason, he added, is that leading members of the ''mathematics cadre'' in the Soviet Academy of Sciences ''just don't like Jews.''

In addition, he said, ''they don't seem to put any great value on people who just work in the general field of mathematics.'' It would be much more difficult, he said, for computer scientists and engineers to emigrate. Moreover, mathematicians are less likely to have been employed by enterprises ''that worry the Soviets with their obsession about security.''

By Soviet standards, many who emigrate, Dr. Nathanson said, have held insignificant jobs. He termed it incongruous that the Russians spend so much energy in getting young people to study mathematics, and yet do relatively little to place them in important work. For Jews in the Soviet Union, he said, ''it is almost impossible to get mathematics jobs in universities or research institutes.''

To keep Jews out of the upper levels of the mathematics establishment, Dr. Nathanson says, they are given ''strange examinations and particularly obscure questions'' or are denied the opportunity to defend their doctoral theses. He quoted Lev S. Pontryagin, a member of the Soviet Academy of Sciences, as saying, ''Jewish mathematics is bad mathematics.'' Professor Pontryagin, he said, takes credit for having kept a leading American mathematician, Nathan Jacobson of Yale University, from attaining the chairmanship of an international mathematics association.

Dr. Nathanson placed much of the blame for such policies on Ivan M. Vinogradov, director of pure mathematics in the Soviet Academy of Sciences, and on Professor Pontryagin. He described both as ''truly great mathematicians,'' but as ''very conservative and anti-Semitic.''

The influx of Soviet mathematicians into the United States, Dr. Nathanson said, comes at an opportune time. The supply of Ph.D.'s in mathematics is in serious decline. Only 350 such degrees in pure mathematics were awarded last year. While even good mathematicians were unable to find jobs in the mid-70's, he pointed out, a serious shortage of mathematicians has now made it difficult for many small colleges to find mathematics teachers.

Soviet mathematicians who have moved into important positions here include David Kazhdan at Harvard; Victor Kac at the Massachusetts Institute of Technology; Boris Moishezon and Gregory Chudnovsky at Columbia; Boris Weisfeiler and Leonid Vaserstein at Pennsylvania State University; Igor Dolgachev at the University of Michigan; Mikhael Gromov at the State University of New York at Stony Brook; Eugene Dynkin at Cornell, and Ilya Piatetskii-Shapiro at Yale.

Dr. Nathanson believes that many American mathematicians are too narrowly trained in pure mathematics and that the broader experience of the Soviet emigres in both pure and applied mathematics makes them a particularly valuable resource.

For the moment, he feels, the Soviet Union may not suffer too much from this brain drain. In the short run, he says, ''You don't need a great many mathematicians; but in the long run, progress may be retarded.''

Dr. Nathanson recalls weekly mathematics seminars in Moscow attended by young mathematicians ''who didn't have the right stamp in their passports to be allowed to work in the capital.'' He compared them to the underground artistic community. Many were, he said, very good mathematicians, but they had no standing within the official mathematics community. Those, he said, are people who try to emigrate and, if they come to the United States, whisk through the Ph.D. requirements and get jobs.

Until recently, Dr. Nathanson concluded, he judged the United States and the Soviet Union about equal in the quality of high-level mathematics. At present, he said, the United States is probably ''a bit stronger.'' Since a considerable percentage of the Soviet Union's mathematicians has been Jewish, he said, the policy of impeding their study and employment has begun to hurt that country's mathematical strain.

Illustrations: drawing