President Reagan yesterday signed the so-called orphan drug bill, which gives tax breaks to pharmaceutical companies that develop drugs for treating rare diseases, despite some reservations about a section of the bill requiring a government study of whether nuclear testing in western states in the 1950s and 1960s caused cancer.

Reagan acted only hours before a midnight deadline, when the bill would have died without his signature.

"Despite my reservations . . . , I am gladly signing the orphan drug bill," the president said in a statement. "I only wish that with the stroke of this pen I could also decree that the pain and heartache of people who suffer from these diseases would cease."

The government subsidies amount to about $75 million over the next five years for firms that produce drugs to treat about 2,000 diseases. An orphan drug is used to treat a disease affecting a small number of persons and normally would not justify research and production by pharmaceutical firms.

The president's advisers were divided on whether he should sign the measure, partly because it adds to the federal deficit and partly because it represents a federal intrusion into private enterprise.

They also were concerned about the rider attached by Sen. Orrin G. Hatch (R-Utah), which requires that the government prepare tables showing the effects of various levels of radiation on the population.

In his statement yesterday, Reagan said that the relationship between cancer and low levels of radiation has yet to be proven. He said he would order that the tables required by the law be completed to "the extent that may be possible and scientifically responsible . . . ."

The president added that the drug bill, which passed both houses of Congress unanimously, "exemplifies the proper role of government in helping to meet legitimate needs in those cases where the free market alone can't do the job."

Reagan also signed a measure requiring that telephone receivers work with all hearing aids.

And he allowed two bills to die without his signature. One would have extended federal aid to American Indian tribes for community colleges, and the other would have provided $3.3 million to three silver dealers for losses they claimed after the Treasury halted the sale of government-owned silver in 1967.

The new law affecting telephones was necessitated by competition in sales. Until recently, most phones were manufactured by the Western Electric Co., a subsidiary of the American Telephone and Telegraph Co., and worked with hearing aids. But some other manufacturers' phones transmit sound with a system that is incompatible with hearing aids.

Reagan said he reluctantly failed to act to extend the Tribally Controlled Community Colleges Assistance Act of 1978. He said the extension measure stated that supporting such community colleges is part of the government's "trust responsibility toward Indian tribes."

"College-level Indian education has never been characterized in law or treaty as a trust responsibility of the federal government," the president said, "and to do so now would potentially create legal obligations and entitlements that are not clearly intended or understood."

He urged Congress to draft new legislation before the current act expires in September, 1984.

Regarding the silver dealers, Reagan said that if the government honored their claim, it would "estabish an undesirable precedent" for others claiming "hardships due to business decisions made with full awareness of the risks that a change in government property disposal programs might entail."

The silver dealers said the Treasury refused to honor orders placed May 18, 1967, the day the government stopped selling silver. The government had held down the price of silver and sold it to discourage the melting of coins for their silver content. Once the government sale ended, the price of silver soared and the three companies claimed that they lost money because the government did not honor the orders placed the day the government sale ended.