Appointing civil servants to investigate the prime minister's conduct puts them "in a genuinely difficult position", says the cabinet secretary.
Speaking to a Commons select committee, Simon Case - who leads the civil service - said such inquiries were "very difficult" for staff and should "be avoided wherever possible".
A police investigation into 12 of the so-called "partygate" events led to 126 fixed penalty notices being issued, including individual fines to Prime Minister Boris Johnson, his wife Carrie and Chancellor Rishi Sunak.
Asked by the chair of Public Administration and Constitutional Affairs Committee, William Wragg, whether asking civil servants to carry out such probes was appropriate, Mr Case said it should be avoided.
"The role of the civil service is there to support the government of the day whilst upholding the values," he said.
"Its function is not to provide some sort of judicial function over ministers."
The cabinet secretary also said some people "used the language" of calling civil servants "independent", but he said that was "not correct".
Mr Case added: "The civil service is not independent. It is there to act impartially, it's one of our values, but the civil service is there to support the government of the day.
"And, as you say, asking civil servants to do these investigations put these civil servants in a genuinely difficult position."
In the two-hour grilling of the top civil servant, Mr Case said "mistakes were made [and] boundaries weren't observed" during the pandemic, and said the conduct described in Ms Gray's report "would be horrifying in any setting".
He added: "People have let themselves down."
But the cabinet secretary said he remained "deeply proud" of how "unbelievably hard" civil servants worked during the pandemic.
Mr Case was also asked by Labour's John McDonnell whether No 10 press officers - who the former shadow chancellor described as "lying toads" - would be disciplined for misleading journalists over partygate.
The cabinet secretary revealed there was an "ongoing disciplinary process" happening in Downing Street, but said said the public may never know if action was taken against any spokespeople.
After further heated exchanges, Mr Case said he would find out what could be made public from fellow civil servant Alex Chisholm, who is leading on the disciplinary action.