President Reagan yesterday vetoed a bill that would give him the power to set prices and allocate petroleum supplies in an oil shortage emergency, powers he had said he did not want. In rejecting the measure, the president said that "no magic federal plan" can protect the nation from such a disruption.

The bill, the Standby Petroleum Allocation Act, would leave it up to the president whether to use the authority it conferred. It would, however, require that plans be drawn in advance of a crisis.

The veto, Reagan's second, sends the measure back to the Republican-controlled Senate, where it has the best chance of being overridden. If the issue gets to the House, it is expected to touch off a massive lobbying war.

A two-thirds vote by both houses is required to override a veto. The conference report on the allocation bill passed the Senate by a vote of 86 to 7, and passed the House by 246 to 144.

Reagan sided with those who argue that a free market is the best mechanism for dealing with a crisis in oil supplies. The bill was based on an assumption that Reagan called false: "that giving the federal government the power to allocate and set prices will result in an equitable and orderly response to a supply interruption."

Americans have to be prepared to shoulder some costs in the event oil supplies are interrupted, he indicated. "Proper preparation beforehand and free trade among our citizens afterward can mitigate these costs, but no magic federal plan can simply make them go away," he said in a veto message issued from Camp David.

Sen. James A. McClure (R-Idaho), who had strongly urged the president to sign the bill, said he was disappointed by the veto. "There are those who say that the market always orders supplies better than the government," he noted. But he said that in some situations government intervention is required. The bill leaves it up to the president to determine whether that is the case, he said.

McClure said it is premature to talk about whether to try an override. "We'll be talking about other alternatives, but if the president doesn't like that bill, I doubt there's any bill he is going to like," he said.

Other supporters of the bill criticized the president's decision to veto it. Rep. Philip R. Sharp (D-Ind.), chairman of the House subcommittee on fossil and synthetic fuels, called it "a serious mistake and an unfortunate sign of complacency and lack of preparedness for the next energy crisis."

Sharp also said that if a crisis occurs Congress is likely to impose "very strict, nondiscretionary controls."

"The president has transferred from government to the major oil companies the power to protect the nation's security during an oil supply disruption," said Ed Rothschild, a spokesman for the Energy Action Project of the Citizen-Labor Energy Coalition.

Among the groups that supported the Standby Petroleum Allocation Act and urged the president to sign it were several of the major oil companies. Their support for the bill was based, in part, on concern that they would have to live with 50 different state allocation and control laws unless there were a federal plan.

Other groups that support the bill include the major farm groups, truckers, independent refiners and marketers and the National Governors Association.

Opposed to the bill were major administration policy makers, some smaller oil companies and users such as General Motors and Holiday Inns.

Energy Secretary James B. Edwards indicated in a speech last week that the administration was looking for other ways to preempt the states and assuage concerns about multiple allocation and control laws.

"I don't know why you'd interfere with state's rights if you don't want to intefere with the market," McClure said yesterday.