For years, the military had been heading the other way. Mandatory budget cuts caused the Army to shed more than 100,000 troops from 2010 to 2016. The Army was not only recruiting fewer soldiers, but was forcing troops out. It was on course to shrink to 450,000 soldiers in 2017 when Mr. Trump did an about-face. Fulfilling a campaign promise to stop the drawdown, he signed a bill that expanded the Army to 476,000. This year it was supposed to grow to 483,500, but actual numbers remained flat.

The Navy, Air Force and Marine Corps met their recruiting goals for 2018, but the Army, which is by far the biggest branch of the military, had to recruit more than twice as many troops as other branches. Initially, the Army planned to recruit 80,000 soldiers in 2018, but lowered its goal to 76,500 in April because it was able to retain more soldiers already in the force. That still left a much larger-than-normal task for Army recruiters amid a roaring economy.

At an urgent care center in the suburbs of Denver on Friday, Josh Griffin, a high school senior, had just finished taking a drug test for a new job at a discount tire company down the road. He said that recruiters had talked to him in high school, and that the military sounded appealing at first: money for college, a steady job and a way to give back to his country.

But now he sees better options, he said, adding, “I don’t have any doubt in my mind about finding a job.”

The military’s promise of college tuition and other benefits has less of a draw, said Sgt. First Class Michael T. Peppers, the commander of a strip mall recruiting station next to a Subway and a Tasty Tacos in Urbandale, Iowa.

“We’re competing with other businesses offering the same things,” he said, noting that even McDonald’s has a program to help employees pay tuition.

The military also says it has to pick from young adults who are increasingly unqualified to serve because of mental health issues, criminal convictions or obesity.