The affidavit, set to be released on Friday, will be significantly redacted but was expected to reveal more information about the FBI’s ongoing investigation into the former president’s handling of classified documents.
The Department of Justice opposed releasing an uncensored version of the affidavit.
Federal officers searched Mr Trump’s Florida home this month and seized boxes of files.
US presidents are required to transfer documents and emails to the National Archives when they leave office. Federal agents are investigating potential violations of three laws, including one on gathering, transmitting or losing defence information under the Espionage Act, according to documents already been made public.
Mr Trump has denied wrongdoing and insists the classified files investigators say were found had been declassified by him.
On Thursday Judge Bruce Reinhart in Florida ordered the affidavit to be released with redactions by noon Friday. He said prosecutors had demonstrated a “compelling reason” to black out parts of the document, which would identify witnesses, law enforcement agents and uncharged parties.
Mr Trump indicated on social media he supports unsealing the affidavit but his lawyers never filed a formal motion to that effect, and instead left the effort to a coalition of media outlets.
The former president has characterised the investigation as politically motivated and unlawful.
His legal team this week asked that an independent third-party attorney oversee the documents that the FBI seized.