The injured racehorse panted into a rage, nostrils flaring and ears drawn back in fear. Then he rose to strike at the gray-haired veterinarian trying to attend to his right leg.

On a oppressively hot day here last week, the horseflies stinging and the smell of farm animals wafting through the stable, veterinarian Lee Miller of Woodsboro, Md., stood fast as "Come On Fred," a $300,000 winner at Rosecroft Raceway and one of Maryland's most celebrated harness racers, reared up and down. The 9-year-old standardbred had been injured following a race.

Nearby, as Miller steadied the animal, a small child watched tensely, peering through the slats of the old stable, a toy horse clutched tightly in her arms.

The 50-year-old veterinarian gave the horse a tranquilizing shot in the neck, stroked him until he was quiet and plucked out several steel stitches in the fractured leg.

Pulling a stethoscope from his blue overalls, the vet listened to the animal's heart, patted him affectionately again, and told Jenny Uebel, 6, daughter of trainer Bob Uebel, that the horse would be okay.

Miller, one of 38 veterinarians in the county, is the first to acknowledge that country vets like himself are a vanishing breed.

"There's so many subspecialties in veterinary medicine today," he observed. "If your dog has heart trouble, you can take him to a cardiologist. If he has cataracts, you take him to an ophthalmologist. Me, I just enjoy being around cows, horses and people."

Ray Thompson, executive director of the Maryland Veterinary Medical Association, says that most of the 900 veterinarians in the state work with small animals and notes that there are many specialists in heart, eye, skin, and foot diseases.

Miller was raised on a farm in Evansville, Ind., studied at Cornell University and came to Frederick County 23 years ago to set up a practice.

"To be a good farm veterinarian, it helps to be raised on a farm," Miller's assistant, Dr. Marcia Vandermause, maintains. "You have to know farm economics and crops, the psychology of farmers and of animals."

Today, Miller sees about 1,000 farm animals a week, operating out of a 200-acre farm near Woodsboro. He says it's not unusual in a practice like his to give "pregnancy exams to 155 cows in one day."

The first house calls begin around 7 o'clock in the morning on Miller's specially designed, rescue-squad-like truck. It is filled with surgical instruments, emergency lighting equipment and medicines he will need out in the field. His 12-year-old Lhasa apso, "Killer," who has "only seven good teeth left to his name," goes with him on his rounds.

"I carry with me 50 times more medicine than a regular veterinarian," Miller said. "It takes about 200 times the medicine to treat a 1,000-pound cow than it would take to treat my friend Killer here."

The occupation has its hazards, he says. Miller has had his share of broken legs and horse bites. Last week, Vandermause's hand was broken when she was kicked by a cow she was treating. A few days later, the recent Ohio State University graduate had recovered enough to operate on a cat, however.

Miller's day on the farm last week went into the night. There were cows to inspect and Pat Reeves' 22-year-old horse in New Market needed a flu shot.

Pat Reeves recalled that once Miller came "five times a day to keep this old horse alive--when three other veterinarians told me he should be taken out to pasture and shot."

Frederick remains a largely rural county, despite its subdivisions and the importance placed by its officials in recent years on economic development and light manufacturing. Farming is a $90-million industry in Frederick; the county, the largest in Maryland, is home to 38,000 dairy cows, 20,000 beef cattle, 5,000 hogs, 67,000 laying hens and 11,000 broiling chickens.

But the blistering summer drought of 1983 has taken its toll on the farms, where crop production is off by as much as 50 percent, state officials said. Gov. Harry Hughes has requested federal disaster aid for farmers in Frederick and five other drought-stricken counties. Farmers have indicated that feed here is scarce and say milk production is expected to drop.

Meanwhile, Miller said, the cost of maintaining good health for farm animals can be staggering. "Most of the farmers here run up a $5,000-a-year veterinary bill," he said.

Many farmers say they are having trouble meeting their bills because of the drought, he added: "I get a lot of fruits and vegetables in return for my services, but usually I'm the last one to get paid money."

Cows are basically manufacturing plants, observes Dr. Richard E. Card, a 38-year-old Frederick veterinarian who specializes in treating dairy cattle and their nutrition needs. The typical dairy cow lives five years and gives birth to about three calves, he said. A cow eats 60 pounds of hay and grain a day, which converts into 10 or 11 gallons of milk, he said.

Card uses computers and employs a full-time nutritionist in his practice. Under his diet program for dairy cattle, he maintains, the average cow produces 16,000 pounds of milk a year, and in some instances as much as 25,000 pounds.

Miller is also trying to increase milk production, using a surgical procedure known as embryo transfer. A genetically desirable cow is given hormones to allow her to produce 12 to 15 eggs, which are transferred to infertile cows. The cost for the operation is about $1,550 per cow, Miller said. Las week, he said, he transferred 40 eggs to infertile cows, which will produce offspring that, it is hoped, will increase the owner's milk production.

Milk cows that don't produce milk or other cows become "McDonald's hamburgers," he noted.

Cows and horses often get respiratory diseases such as bronchitis, pneumonia and influenza, with symptoms remarkably similar to those of humans.

Cows also get "hardware disease," the result of inadvertently eating wire and nails. Sometimes the metal punctures a compartment of the cow's stomach and lances the heart. Veterinarians prevent the disease by prescribing magnets, which contain the nails, Hammond said.

While today's agricultural entrepreneurs tend to be more scientific in their approach to dairy farming than they were when Miller began his practice, the vet says he knows one farmer who continues to rely on his own pregnancy test for cows. The farmer ties a nail to a string, holds it over the cow's head, and if the string moves in a circle, the cow is considered pregnant; if the string doesn't move, he calls Miller to do further testing.

And few farmers still put salt and pepper on the tails of cows that are lying down--an old "treatment" for tired animals with calcium deficiencies, he said. Today, Miller said, he is called to administer shots instead.