The UK’s top official, Sir Mark Sedwill, confirmed that he plans to step down in September.
In a letter to Boris Johnson, he said it was the right time to go, as the government moved on to the next phase of its coronavirus recovery plan.
His departure follows reports of tensions between him and the senior members of Boris Johnson’s team.
The senior civil servants’ union, the FDA, said Sir Mark was harmed in a “cowardly” way.
FDA Secretary General Dave Penman accused unnamed Downing Street officials of reporting against Sir Mark.
He added: “It is not only a self-destructive and corrosive tactic, but also a coward, safe in the knowledge that those who are informed against it are unable to respond publicly.”
He said the government would be “weaker as a result” of Sir Mark’s departure.
Sir Mark’s other role as a national security consultant will be taken over by Johnson’s chief Brexit adviser, David Frost.
Dominic Cummings, considered the prime minister’s most influential political advisor, has long called for a review of public service.
And in a speech on Saturday, Michael Gove attacked what he called “group thinking” within his ranks.
As cabinet secretary, Sir Mark advised the prime minister on policy implementation and government conduct.
A career diplomat, he served as ambassador to Afghanistan during a 20-year career at the Ministry of Foreign Affairs. He took over as cabinet secretary shortly after Sir Jeremy Heywood’s death in November 2018.
He had previously worked alongside former First Lady May, as the highest official in the Interior Ministry.
After he leaves government service in September, Sir Mark will be considered a peer and will also chair a new panel on global economic security when the UK takes over the presidency of the G7 group of nations.
Several senior civil servants have stepped down or are due to leave in the coming months after the resounding victory of conservatives in December.
Philip Rutnam is suing the Interior Ministry for unfair dismissal after leaving in February, while Simon McDonald is leaving the Ministry of Foreign Affairs in September after his merger with the Department of International Development.
Sir Mark said he served Johnson and his predecessor in “extraordinary times”.
“Two years ago, when my predecessor fell ill, your predecessor asked me to take over as Cabinet Secretary and you asked me to continue supporting you through Brexit and the election period,” he wrote.
“Obviously, it was right to continue in the acute phase of the Covid-19 crisis. As you are starting this week, the government’s focus is now shifting to domestic and global recovery and renewal.”
In response, Johnson said Sir Mark had made a “massive contribution” to public life in the past 30 years and was a source of “insightful advice”.
“You did it all in Whitehall: from Afghanistan to modernizing the public service; from immigration policy to Brexit and the defeat of the coronavirus,” he said.
“After serving for decades with great distinction – and unwavering good humor – I believe that you have won the nation’s gratitude.”
Cabinet shadow minister Helen Hayes paid tribute to Sir Mark, saying that he performed with dedication in “difficult times”.
But she added, “On the day it was revealed that millions of jobs across the country could be threatened in the coming months, it is very worrying that Boris Johnson and Dominic Cummings are concerned with reorganizing Whitehall.”
At No. 10, Frost said he would succeed Sir Mark as a national security consultant, also occupying a seat on the Lords, but would continue to oversee negotiations on a trade agreement with the EU until completion.