For almost as long as anyone can remember, Mildred C. Butler has been keeping the files at the Caroline County Courthouse here in the seat of Maryland's self-styled "Green Garden County" on the Eastern Shore, through which Washingtonians often pass on their way to the beach.

Butler, the 75-year-old clerk of court, seldom leaves the courthouse for lunch and took only one day's vacation this year. "This office comes first," she said. "It's my life, really."

She apparently has done the job she holds so dear well enough that she hasn't been challenged since 1966--until this year. Suddenly this summer, the post of clerk of court has become the biggest prize in Caroline County politics, attracting candidates like flies to honey.

It may be a sign of the times that four young men (two Democrats, two Republicans) are scrambling for this nonpolicy-making post. In a rural county (23,143 residents) with few white-collar jobs to retain its educated young people, the court clerk is the highest-paid elective office. It pays what folks here regard as the lofty sum of $25,000 a year, and that amount is scheduled to go up next year.

With Democrats outnumbering Republicans 2 to 1, Tuesday's primary is regarded as the major contest, and in that balloting, Butler faces two Democratic opponents, J.O.K. (for James Owens Knotts and pronounced "jock") Walsh, 34, and Carl L. Thornton Jr., 29.

The three Democrats and two Republicans have raised a total of $6,000 -- more than all candidates in all other races combined -- and the contest has produced an intensity rarely seen in these parts. Butler, who says she knows little about politics, is passing out 2,500 sewing kits and 5,000 match covers (with her picture and the message, "I Stand on My Record") and spending more than $2,000 -- most of it her own money -- to stay in office.

Walsh, in particular, has made the incumbent's age an issue, raising it in a public debate and campaigning on the slogan, "It's Time . . . to Let a Fresh Generation Begin." Butler responded by suggesting that Walsh wants her job because he has twice failed to pass the bar exam.

The exchange, at a candidates forum, shocked this normally sedate county where almost everyone knows everyone else and campaigning has long been a genteel activity. It is a place where political rivals are often friends or acquaintances and can't avoid seeing each other virtually every day.

In this contest, for example, two of the five candidates -- Butler and Thornton, the county codes administrator -- work in the courthouse, a third spends most of his time there researching files, while Walsh lives across the street and works around the corner in his uncle's law office.

"He and I are best friends," Butler said of Republican hopeful Bill Paugh, 34. "If I was so fortunate to win the Democratic primary and he the Republican, I don't know how we'd get along against each other. It'd be difficult," she said. Paugh, a paralegal aide conducting a title search nearby, nodded in agreement.

But Butler feels differently toward Walsh, who unabashedly raised the age issue in his campaign. "I was floored; I never expected anything like that," she said of the ensuing exchange, which the local paper said it hoped would be "the only indiscretion in a heated campaign." Butler added, "It's not my idea of running a campaign to go around and try to destroy someone else."

In defense of his strategy, Walsh said, "If you want young people to be able to stay and live in Caroline, there has to be some jobs for them. This is one of the few good jobs in the county. She's done a good job. I like her personally, but there comes a time to step aside."

Saying that she is seeking her last term, Butler replied: "I don't see why I should have to sit home and do nothing while someone else comes in who doesn't know hardly a deed from a mortgage." She is in good health, she asserts, and willingly spends long hours each day at the courthouse.

As a campaigner, however, Butler is struggling in an alien arena. She went to work in the clerk's office in 1959, quickly became chief deputy and was appointed to the top job upon the death of clerk D. Ralph Horsey. She easily overcame primary opposition in 1966 and hasn't had to campaign since. In 1972 her husband died, leaving her, she said, without an adviser or political confidant.

Thus her campaign organization consists of herself and her sister and a few friends. She has bought $1,200 in stamps for a mailing but is undecided about such direct tactics. "I can always take the stamps back," she said.

She was even reluctant to have posters printed, but Ted Agapaloglou, who owns the Corner Restaurant near the courthouse, promised her a prime spot in his campaign placard-filled windows. So she had eight dozen posters made, but half of them are still sitting in her car.

Walsh, on the other hand, is no reluctant campaigner. His widely distributed literature notes that he once foiled a bank robbery, stresses his Vietnam service and his legal background, despite his unsuccessful efforts to pass the bar examination. "I'm of average intelligence," he explained. "I worked like hell to get through college."

He is also running on his family credentials: His cousin is the Circuit Court judge, as was his grandfather, and his uncle has been the state's attorney. Another relative was a well-known country doctor. Campaigning at a recent senior citizens luncheon, Walsh invoked all their names.

William Zahniser, 76, responded favorably. "It might as well be him because Mrs. Butler's been there too long," he said. "When you pass 65 or 70, you're not up to snuff. At 75, she oughtta be home with her feet propped up."

A woman seated nearby agreed but requested anonymity because, she said, "Mildred's such a good friend."

Walsh -- who peppers his political talk with quotes from Teddy Roosevelt, Mark Twain and John Gunther -- has also been knocking on doors since July, covering every house in the south county towns of Federalsburg and Preston at least once. Hitting several houses the second time recently, he received a mixed response. "Well, I'll say this for you," said Cornelia Plummer, "you're persevering." She later said she was undecided on her choice.

Carl L. Thornton Jr., the other Democrat in the race, has only recently taken time off from work to campaign. "I believe in myself," he said. "I've been brought up in the institution of life." To bolster his campaign, he has 12 "Thornton for Clerk" caps and T-shirts for his two children that say "Please Support My Dad" in front and "Elect Carl Thornton Clerk of Court" on the back.

In the Republican primary, Dale ("Back a Winner") Minner, 29, a real estate appraiser, garnered attention by giving 200 carnations to the Republican Women's Club for their Lincoln's Day dinner, distributing Baltimore Orioles game schedules and advertising his candidacy at the annual Choptank River regatta on a specially embroidered sail. He has, however, avoided the age issue. "I've never believed in mandatory retirement," he said.

Paugh's campaign has been the most modest. He is spending only $120, he says, much of it on literature that includes a spirited endorsement of his candidacy by his wife, Sandra.

The candidates have few public endorsements to wave at the voters. Peter Jensen, editor of the County Record, said his paper would "probably lose half our subscribers" if it took sides in the race. "It's such a small town," said a saleswoman in a Denton clothing store when asked her preference. "I wouldn't touch that one with a 10-foot pole."