The federal appeals court ruled here yesterday that the Agriculture and Interior departments violated the law when they leased 28,000 acres of wild national forest land in Idaho and Wyoming for oil and gas exploration without studying all the possible environmental impacts.

Environmentalists and administration officials said the ruling could affect tens of thousands of acres of other national forests and federally owned lands, significantly narrowing the government's power to award mineral leases in environmentally sensitive areas.

The leases involved in yesterday's case, Sierra Club v. Peterson, cover fragile portions of the Targhee and Bridger-Teton national forests that are under consideration for the national wilderness preservation system, a designation that permanently bars oil and gas development.

The government issued no environmental impact statement on the leases, contending that merely issuing a lease poses no danger to the environment. Other permits are required before a company can break ground.

However, the U.S. Court of Appeals for the District of Columbia Circuit said this approach violated the National Environmental Policy Act because it "sanctioned activities which have the potential for disturbing the environment without fully assessing the possible environmental consequences."

The decision is significant because the administration has used the same rationale to award leases without completing impact statements in many environmentally sensitive areas, officials said.

"This opinion uses reasoning that is very broadly applicable," said Howard Fox, an attorney for the Sierra Club Legal Defense Fund who worked on the case. "It appears that it could apply to all leasing that could have some environmental impact on sensitive areas, and not just in national forests."

A similar lawsuit is pending against leases awarded on 42,000 acres of potential wilderness in Montana's Deep Creek National Forest. Administrative appeals have been filed against leases awarded in Vermont's Green Mountains National Forest and Missouri's Irish Wilderness, according to Sierra Club lawyers.

These forests are among several million acres that the government says have "wilderness characteristics," but that Congress has not included in the wilderness system.

They represent much of the potential for expanding the wilderness system, which now covers 24 million acres in the lower 48 states. Leasing in these potential wilderness areas is banned during fiscal 1983.

Under yesterday's ruling, the Forest Service can forgo an environmental impact statement only if a lease includes the right for the agency to cancel it after further environmental studies. Forest Service officials said the ruling will make the leasing process much more expensive and time-consuming in potential wilderness areas.