After more than 45 years in the Interior Department, the federal program charged with protecting crops and livestock from the attentions of wildlife is headed back to the Agriculture Department, to the delight of western cattlemen and sheep producers and the dismay of conservationists.

Western livestock producers have battled unsuccessfully for decades to return the program to USDA, where it operated for eight years until being shifted to Interior's Fish and Wildlife Service in 1939.

Until last year, their efforts were routinely thwarted by wildlife groups, who feared a return to the days when predator species were slaughtered in vast numbers without regard to the impact on other wildlife.

But last year, Sens. James A. McClure and Steve Symms, both Republicans from Idaho, handcuffed conservationists and their congressional allies by slipping the transfer into three pieces of legislation -- the 1985 farm bill, the Agriculture Department's appropriation bill and the omnibus spending bill approved just before Congress adjourned in December.

A last-minute push by conservation lobbyists succeeded in stripping the transfer from the farm bill, but the effort came too late to remove the language from the spending bill, into which the Agriculture appropriations bill was folded. The spending bill, known as a continuing resolution, provided funding for a number of federal agencies.

"We didn't know about it until the last minute," said an aide to Rep. John F. Seiberling (D-Ohio), who had joined with Reps. John D. Dingell (D-Mich.) and Morris K. Udall (D-Ariz.) in threatening to kill the farm bill if language moving the program to USDA was not deleted.

"There were no hearings on it, and we were never able to unearth a single piece of paper from the secretary of the interior or the Fish and Wildlife Service consenting to it," Seiberling's aide said.

The program involves just 370 employes and annual appropriations of less than $20 million, but the transfer has long been a priority for western ranchers, who contend that Fish and Wildlife Service policies are tilted toward the wildlife.

"The stockmen say Agriculture should have the responsibility because they will protect the livestock and to hell with the rest of the wildlife," said one Interior official.

Western ranchers see things a little differently. For years they have fought a running battle with the federal government over the control of predators on federal land, which provides grazing range for many of their animals. Interior's overriding interest in preserving wildlife, they contend, is costing them millions of dollars every year in lambs and calves.

Their arguments have made some headway under the Reagan administration, which earlier this year agreed to again permit the use of Compound 1080, a popular bait poison that had been banned for 13 years because of its ability to kill bald eagles and other threatened species as well as coyotes.

In the waning days of Congress last year, according to administration officials, stockmen saw an opportunity to gain a more significant advantage on the wily coyote by transferring the predator program back to USDA.

"The cattlemen, the wool growers felt the program was more appropriately aligned with Agriculture because of the philosophy and the charge of USDA to protect agriculture," said Bob Acord, an official with the Animal and Plant Health Inspection Service (APHIS), which will inherit the program. "They felt there was a conflict with Interior and its protection for animals."

The legislation had the approval of the Office of Management and Budget, as well as Agriculture Secretary John R. Block, and "the producing organizations really got behind it," Acord said. "They really put an effort into having it transferred."

According to USDA officials, the move is expected to be complete in 90 to 120 days.

Conservationists, however, contend that ranchers may find their victory short-lived. Moving the program to USDA is likely to increase pressure to abolish the program entirely, they said, and a deficit-conscious Congress might be of a mind to do exactly that next year.

The animal-damage program "has been offered up for elimination regularly," said Maureen Hinkle of the National Audubon Society. "I think by seeking a transfer, they've just elevated the controversy."

Seiberling's aide agreed. "To wipe out that program totally would be a relief to environmentalists and the Fish and Wildlife Service," he said.