Max Stier is president and chief executive of the Partnership for Public Service, a nonpartisan nonprofit that regularly contributes profiles of federal workers for The Post’s Fed Page.

During the past week, revelations about misdeeds by Internal Revenue Service employees have provoked widespread and understandable outrage and provided ammunition for those who like to tear down government and its employees.

Just last month, headlines told a far different story — one of public servants playing critical and, in some instances, heroic roles as the nation experienced a series of disturbing events in rapid succession: the Boston Marathon bombings; the ricin-laced mailings to the president and a U.S. senator; a deadly fertilizer plant explosion in West, Tex.; and severe flooding in the Midwest and, in the background, saber-rattling from North Korea.

In these cases, law enforcement officers, first-responders, public health professionals, forensic analysts, intelligence officers and diplomats were on the job, answering calls for help, providing expertise and guidance, risking — and, in some instances, losing — their lives.

First lady Michelle Obama told a group of government employees last month: “Federal workers are this invisible face. No one knows what they do, what it means, how much they benefit us.”

It is unfortunate that the work of federal employees is invisible to so many Americans until there is a crisis or something goes wrong in government, as is inevitable when such a complex organization serves 311 million Americans. But day in and day out, public servants deliver essential social services, take care of our veterans, protect our food supply and environment, help small businesses, fight terrorism, carry out U.S. foreign policy, maintain our transportation systems, run our national parks, safeguard consumers and find cures for diseases.

The lack of public understanding about what federal workers do, combined with occasional missteps, has made it easy for Congress to enact a three-year pay freeze for federal employees and shortsightedly impose arbitrary, across-the-board spending cuts through sequestration. This is leading to unpaid furloughs for thousands of workers as well as hiring freezes, and it has made it harder for employees to do their jobs.

Federal workers are motivated not by fame or fortune but by a desire to serve our country. Many were inspired to join government ranks after 9/11, just as the Cold War generation answered President John F. Kennedy’s call to service. But if we are not careful, those passionate and talented people will become discouraged and leave. Attracting top-flight employees to institutions that are chronically maligned will be increasingly difficult.

Seldom does the public hear about the achievements of federal employees, but there are many noteworthy and inspiring accomplishments that deserve recognition — in addition to the work of the brave public servants who are addressing our nation’s crises.

There is David Lavery of NASA, who is leading the Curiosity rover mission to Mars that is exploring the Red Planet’s geology and climate, and assessing whether conditions are favorable for microbial life and future human exploration.

Margaret Focarino of the U.S. Patent and Trademark Office led bold reforms that dramatically improved the speed and quality of patent examinations and approvals, helping to boost new technologies and spur economic growth.

At the Small Business Administration, Harry Haskins helped revitalize a waning program for investment in small business, putting billions of dollars in the hands of entrepreneurs who have created thousands of jobs since 2009.

And at the National Institutes of Health, Julie Segre and Tara Palmore stopped the spread of a deadly hospital-acquired infection through the first-ever use of genome sequencing to identify the source and trace the transmission of antibiotic-resistant bacteria, creating a groundbreaking model for the health-care industry.

As a society, we need to encourage government service. The public should also expect better from our political leaders, many of whom reinforce negative government stereotypes at every turn. Although it is essential to find and address problems in government such as the recent improper actions at the IRS, we need to avoid condemning the entire institution and all federal employees. “Fed-bashing” has consequences.

Surveys show a decline in job satisfaction among federal employees, worry about the personal financial effects of the pay freeze and furloughs, a low level of interest in government employment among college students and, perhaps most disturbing, a declining level of public trust in government.

After Boston bombing suspect Dzhokhar Tsarnaev was captured last month, residents of Watertown, Mass., poured onto the streets, cheering and clapping for the police and first-responders. Public servants deserve applause, but not just in high-profile situations.

While our government must deal forthrightly with its problems, we will never get the government we want and need if we continually demonize it or fail to value those who dedicate themselves to public service.