A federal judge here yesterday rejected a bid by three former top FBI officials to have a criminal indictment against them dismissed on grounds that the government's destruction of more than 1,500 FBI documents in the case had prejudiced their right to a fair trial.

U.S. District Court Judge William B. Bryant made the ruling after listening to two days of testimony about the file destruction, including an account from a former FBI section chief who described how he systematically went through his files and kept documents that tended to clear him of wrongdoing in the case and ordered his secretary to destroy others.

Lawyers for former FBI acting director L. Patrick Gray III and two of his top aides, W. Mark Felt and Edward S. Miller, had argued that the file destruction represented the "grossest negligence" possible on the government's part and that the destroyed documents might have contained information to help clear the men.

Gray, Felt, who once was the FBI's No. 2 man, and Miller, who formerly headed the bureau's intelligence division, are charged with authorizing illegal government break-ins at the homes of relatives and acquaintances of radical Weather Underground fugitives in the early 1970s. Barring further delays, their trial is scheduled to start Jan. 22 and may last four to six weeks.

Bryant gave no specific reason for his ruling. The government prosecutors and government witnesses said that most of destroyed documents in the case were contained in so-called "tickler" files which contained copies of documents stored in the main FBI records. But witnesses also said that some of the missing files were originals.

The former FBI section chief, Robert Shackelford, testified that he "went through the folders [in his former office] and found some material that should be retained and instructed my secretary to destroy the rest."

Shackelford, who is an unindicted coconspirator in the Gray-Felt-Miller case, headed the FBI's internal security section until Aug. 18, 1976, the day before FBI agents raided his office and seized hundreds of documents concerning the FBI's widespread surveillance and investigation into the activities of the Weather Underground. Shackelford was transfered to another FBI section and retired three months ago.

Shackelford said he didn't think he had his secretary, Pauline C. Nommensen, destroy any original documents. But Shackelford conceded that he was not sure whether a directive from FBI former director Clarence M. Kelley against destruction of documents relating to the FBI's surreptitious entries was still in effect when he ordered the destruction.

Kelley had issued such an order on April 27, 1976, but issued a new order on Oct. 7, 1976, saying that destruction of most copies of documents could resume.

Shackelford, although he had been removed 2 1/2 months earlier as the internal security section chief, said he walked back into his former office in early October 1976 and started sifting through his files.

"I was concerned about the material," Shackelford said in explaining why he destroyed the documents. "A lot of the material was highly classified. Frankly, that was my major concern."

But under questioning by Justice Department attorney Francis J. Martin and defense attorneys, Shackelford said that the material he retained "was of historical nature and could possibly have been of some benefit to me" in explaining his actions in connection with investigation of the Weather Underground. He said he was aware that he was under investigation at the time of the document destruction.

Lawyers connected with the case say that Shackelford destroyed 47 files. Shackelford said he didn't know the precise number, but said he retained "two thick notebooks" concerned with the case and destroyed "two-thirds or three-fourths or slightly more" of the documents in two two-drawer file cabinets.

The Justice Department has decided not to prosecute Shackelford, but has 68 FBI agents under administrative investigation in connection with the break-ins directed at the Weather Underground.

Nommensen, Shackelford's secretary, testified that she did not destroy any original documents, but said that she cannot remember what all the documents were.