Had she worked in the private sector or for a state or local government, she would have had to prove that her age was a determining reason for the denials — a “but for” cause in the legal jargon. The question for the justices was whether federal workers can win age discrimination suits under a more relaxed standard, showing only that age was one factor among many leading to a negative employment determination.

Justice Elena Kagan, 59, explained the difference between the two standards.

“There are two kinds of concepts you can use,” she said. “They are: Did this thing actually cause the firing or the lack of promotion? Or was this thing around when they made that decision?”

The words of the relevant law, said Roman Martinez, a lawyer for Dr. Babb, allowed her to sue under the relaxed standard. The law says that “all personnel actions affecting employees or applicants for employment who are at least 40 years of age” shall be “made free from any discrimination based on age.”

If the process for making an employment decision uses age as a negative factor, Mr. Martinez said, quoting the law, “it’s not ‘made free from any discrimination.’ ”

The chief justice’s question about a stray if stinging remark of “O.K., Boomer" — a dismissive retort used by younger people — was meant to test the limits of Mr. Martinez’s argument. “So calling somebody a ‘boomer’ and considering them for a position would be actionable?” Chief Justice Roberts asked.