PRESIDENT TRUMP said last week he would be “proud” to shut down the federal government — and when the boss has an attitude like that, it is no surprise that federal employees take somewhat less pride in laboring for their employer.

The nonpartisan Partnership for Public Service released its annual survey charting employee morale across government agencies last Wednesday, and after three years of post-recession progress, the numbers have dipped. Less than 40 percent of agency ratings increased, compared to more than 70 percent in the past three years. The public sector is constantly competing against a private sector that often can offer higher salaries, and numbers such as this year’s suggest government will continue to lose.

There’s no doubt that the administration’s anti-“deep state” rhetoric repels the national resource of smart, civic-minded Americans deciding where to take their skills. But there are steps government can take to guard against workforce depletion, notwithstanding a hostile president. That starts with bringing in younger workers; only 6 percent of federal employees are under age 30. Fresh technical talent is especially lacking: Nearly five times more IT employees are 60 or older than under the age of 30.

This is a big problem. The valuable experience of longtime employees is worth much more if they can transfer that knowledge to a younger vanguard. And when it comes to tech, the rising generation has grown up with the gadgets that day-to-day governmental operations depend on. They are familiar with today’s digital landscape, and they have been trained to look to the future. Systems in some departments today are more than 60 years old. No one wants nuclear warheads to be managed by floppy disks, or to go online on tax day to find a failing filing system. Internal improvements at federal agencies can also make workplace life run more smoothly for employees, fueling a virtuous cycle.

Plenty of young people might want to work in government — if government made it easier for them to get there. It takes an average of a discouraging 106 days for a prospective employee to move through the hiring process. A soon-to-be graduate trying to pin down a job may well choose to look elsewhere; agencies should do what they can to speed up the process. Government also tends to place a premium on previous experience over talent, which means agencies rule out plenty of young potential. Investing more in internship programs that lead to full-time employment could help.

Of course, morale still matters. Recruitment only does so much if employees leave within their first two years, as occurs currently for almost half of federal workers. Congress should call hearings to probe underperforming agencies on how they might make changes. And perhaps Mr. Trump should consider changing his tune: These ratings are a report card for the executive branch, and the commander in chief should not like getting poor grades.

Read more: