The bad guys came to town Sunday, but the hundreds of cowboys celebrating the centennial of one of the nation's oldest cattlement's groups showed they knew how to handle bureaucrats from Washington.

More than 700 cowboys and ranchers listened to what officials from the Bureau of Land Management had to say about their long fight over the right to graze steers on public land, and then went out and got roaring drunk. They danced through the night until a beef-and-pancakes breakfast was served at dawn.

The officials, led by BLM Director Frank Gregg, left ty helicopter, however, before the whooping and hollering really started in this relic of a major gold strike ghost town, 6.176 feet high in rugged mountain country.

The occasion was the 100th anniversary of the Owyhee Cattlemen's Association, representing ranchers in the sagebrush country of Southwest Idaho. It is a major beef- and sheep-raising range, 85 percent of which is managed by the BLM for the Department of the Interior.

The BLM has told ranchers in 11 western states since 1946 how many head they can graze on any given acreage. It sets down the rules for rounding up wild horses, which cattlemen say rob them of feed.It builds dams and pipelines to bring water to livestock. It charges ranchers for grazing their cattle.

The cattlemen, most of whom are descended from families who settled this arid area in the mid-19th century, still attempt to live fiercely independent lives in the old western tradition.

But a flood of BLM rules has meant an uneasy relationship with government that has made many ranchers increasingly discontended.

Cattlemen say the BLM is threatening what they regard not as a business, but a unique way of life.

"There were no fences on this land until 25 years ago," said Mike Hanley, 31, a tall, lanky rancher who has 3,000 acres. "The barbed wire came because the government decided it wanted to manage the the range.

"You know, the largest impact on us wasn't hostile Indians, rustlers or the weather. It has been rules and more rules set down on paper.

"All of us have a feeling of helplessness when dealing with government officials who come our way. Ben Mills was out on a tour of Juniper Mountain with the BLM. When said to him, 'Come on in, I'll buy you a drink.'

"'I don't drink,' the BLM man said. 'Well then, I'll buy a cup of coffee.' 'I don't drink coffee.' Out of desperation, Ben asked, 'How about a chaw of gum?'"

That was not quite the case last weekend. The ranchers and a group of leaders from the National Cattlemen's Association representing 280,000 cattlement good naturedly jested with the men from Washington and gave Gregg a white Stetson.

Gregg acknowledged the cattlemen may have had good reason to complain about President Carter's decision to increase beef imports just when they were beginning to recover from a disastrous three-year economic downturn.

However, he said that the key to a return to prosperity lies in the proposed Rangeland Improvement Act, cosponsored by Sen. Frank Church (D-Idaho). The bill proposes spending $2 billion over the next 20 years to make BLM-managed rangeland more productive. The proposal, which has the support of the White House, has passed the House and is in committee in the Senate.

"If Congress enacts the Rangeland Improvement Act," Gregg said, "we will have the clearest recognition yet that this rangeland is important: that it is important for us to make the investment to make the range more productive for wildlife, the public and for ranchers."

The cattlemen, however, listened more intently when Dick McDougal, NCA president, told them of a 55-minute meeting he had with Carter last week about beef imports and prices.

Carter told him, he said, that "overproduction and buying too much in times of prosperity" were at the heart of the ranchers' problems, "not beef imports." This was greeted with a chorus of jeers.

"The answers to the problems of agriculture lie within the free-market system, not within government," McDougal quoted Carter as telling him. "The president said he wanted to see a lessening of government influence in agriculture, but none of us have seen that happening."

Said cowhand Joe Henry, "If they get that act through Congress it will mean the range will feed more animals. That's fine. But is will also mean a whole mess moe things in the rule book. That doesn't mean more freedom to do my job. It means government will be in the saddle out on the range."