Chris Grayling is facing accusations that he is acting like a "cowboy" after a Whitehall whistleblower alleged that the justice secretary has instructed his political staff to put a positive gloss on all parliamentary written answers by feeding them "into a spin machine".

Sadiq Khan, the shadow justice secretary, has written to Grayling's permanent secretary and to the cabinet secretary, Sir Jeremy Heywood, to complain that parliamentary answers from the Ministry of Justice are being "deliberately manipulated for party political purposes".

Labour intervened after a Whitehall whistleblower, described as "a concerned official", contacted the shadow justice secretary to say that officials have been infuriated by the way Grayling's political staff have sought to draw them into "the spin machine".

The whistleblower highlighted the anger among officials by advising Khan how to table parliamentary questions (PQs) in a way that would "paralyse" the justice ministry and undermine Grayling's "weak grip on his department".

Khan, who has asked the ministry's permanent secretary, Ursula Brennan, to investigate the whistleblower's claims, was particularly alarmed last week when the Sun and the Daily Mail ran stories on the basis of a parliamentary question before the answer had even reached his desk.

The answer by Justice Minister Jeremy Wright, released at the height of the furore over the floods but two months after it was tabled by Khan, showed an increase in the number of prisoners held overnight in court and prison cells since the last general election.

The whistleblower told Khan that officials preparing answers to parliamentary questions have been instructed to pay particular interest to questions in 48 areas. These include prisoners in police cells, first-class rail travel, deaths in custody and three areas concerning ministers: advice, complaints, personal matters and meetings.

The whistleblower wrote: "I am sure you will have noticed the increasingly tardy response of the MoJ to PQs from you and your shadow colleagues. This is because the SoS [secretary of state] has instructed SpAds [political special advisers] to review every single response to ensure a favourable reply is presented. As you might imagine this has infuriated officials at all levels with their constant requests for redrafts of accurate answers and dragging them into the spin machine."

The official then offered Khan advice on how to thwart the alleged political tactics, suggesting that he should demand answers to questions on particular days. The whistleblower wrote: "It seems to me that a judicious and co-ordinated use of named day and normal questions, with swift followup when the late response occurs, would effectively paralyse the MoJ, turn officials against ministers and destroy what is left of SpAds' wafer-thin credibility. A complaint to the parliamentary authorities too would undermine the SoS's weak grip on his department."

A Ministry of Justice "background note" advised officials preparing the answer to the question about the detention of prisoners in police cells to bear in mind that Khan has "regularly tabled PQs in relation to prison population". The note asked officials to answer 12 questions in a "PQ action list" before drafting the reply. The first question asked: "Why do you believe the MP has asked the question?"

In his letter to the Ministry of Justice permanent secretary, Khan says he has received no answer to 22 questions he tabled between 18 November and 20 January. These include sensitive matters such as prison capacity and the experience of staff at Oakwood prison run by G4S – all areas highlighted for special treatment by officials in the whistleblower's letter.

Khan says four questions received "holding" answers, three were answered incorrectly, one answered a different question, four were not answered and one was answered after two months but handed to journalists first.

In his letter to Brennan, which was also copied to the Tory MP Charles Walker, who chairs the commons procedure committee, Khan wrote: "You will be aware of the important role parliamentary questions play in the legislature being able to hold the executive to account. Over recent months, there has been a noticeable deterioration in the quality and timeliness of answers to written questions I have tabled.

"Questions go unanswered, some are dealt with via cursory holding answers which fail to be followed up and some provide answers to different questions to that asked. All in all, there appears to be growing evidence that information on the performance of the Ministry of Justice is being denied to me."

Khan said there was a trend in the subject matters that are not being answered correctly. These include the performance of private companies, such as G4S at Oakwood prison and on other private contracts.

The shadow justice secretary wrote: "Some of these subjects are clearly politically embarrassing for the current secretary of state but that in itself is insufficient reason to avoid providing information that I, as a member of parliament and as shadow secretary of state, have a democratic right to obtain.

"I am sure you agree that the whistleblower's allegations and the poor performance of your department in answering my parliamentary questions is a serious issue. As a result, I am calling on you to launch an investigation into the allegations made by the whistleblower, to review the responses (and non-responses) to my tabled parliamentary questions and to make public the outcome of any such investigation.

"It is crucially important that allegations of deliberate obfuscation and evasion are addressed if the public is to maintain confidence in the workings of government and particularly in our criminal justice system."

Khan told the Guardian: "It appears as if I am being deliberately denied information I am entitled to. The only explanation is that Chris Grayling wants to hide how badly he is doing as justice secretary.

"We already know that Chris Grayling acts like a cowboy. His track record isn't great. His last big idea in his last job at DWP was the Work Programme, which has been one big failure. I don't want a repeat of that in justice.

"That's why I've regularly demanded the facts about his policies for prisons, probation, access to justice and sentencing of criminals. If there is a repeat of failure it would be disastrous for public safety and would seriously damage public confidence in our criminal justice system."

Te Ministry of Justice said: "Special advisers are employed to provide advice and assistance to ministers across a wide range of areas, as required and in line with the code of conduct for special advisers.

"The MoJ receives a high volume of parliamentary questions on a wide range of subjects. These vary in complexity, and can sometimes involve compiling detailed statistical information. We are committed to answering PQs in a way that provides the necessary context for members."