A retired high-level Defense Intelligence Agency analyst was found dead yesterday of an apparently self-inflicted shotgun blast in his apartment building five hours after he was to have been arraigned on charges he sold U.S. military secrets to Libya through ex-CIA agent Edwin P. Wilson.

Arlington police said the body of Waldo H. Dubberstein, 75, who was indicted by a federal grand jury on Thursday, was discovered on a chair in a basement storage area at the River Place complex in Rosslyn about 2 p.m. with a 12-gauge shotgun nearby.

Police spokesman Tom Bell said Dubberstein had been shot once in the head. A law enforcement source said last night that four notes in Dubberstein's handwriting were found but declined to reveal the contents. The source said one note was addressed to Dubberstein's lawyers, one to his wife and one to a German-born woman with whom he lived at the apartment. The source did not know to whom the fourth note was addressed.

The FBI had begun searching for Dubberstein about 11 a.m., two hours after the bald, career analyst failed to appear for his arraignment in Alexandria.

District Judge Albert V. Bryan Jr., accepting the arguments of prosecutors who feared Dubberstein had fled the area, issued a warrant for his arrest. Prosecutors and defense lawyers both said they had been told Dubberstein left his apartment overlooking the Potomac River about 8 a.m., headed for court.

Bell said police were called shortly after 2 p.m. by an unidentified man and asked to "check on the welfare" of a person at River Place. Officers who went to the scene were led to the storage room by a tenant whom Bell declined to identify.

Dubberstein, who joined the CIA at its inception in 1947 and later served as a top Defense Intelligence Agency Middle East expert, and his wife of 41 years had been separated for several years, according to a woman who answered the telephone at Dubberstein's wife's home in Alexandria. Law enforcement sources said Dubberstein had been living with a naturalized American who had worked in Washington for the Iranian Embassy during the shah's reign.

Assistant U.S. Attorney Theodore S. Greenberg, who had pressed the case against Dubberstein and had told Bryan that the former analyst had a motive and sufficient funds to flee, went to the apartment building shortly after the body was discovered. Greenberg emerged grim-faced 30 minutes later and refused to discuss the death's impact on the continuing government investigation of Wilson and his dealings.

The case against Dubberstein, who was allowed to remain on the government payroll because of his expertise long after his normal retirement, contained the first formal allegations that Wilson's dealings with Libya had involved secrets from the top levels of the government's intelligence agencies.

Dubberstein's is the third death in the complex prosecution of Wilson, twice convicted recently on arms and explosives smuggling charges related to dealings with the Libyans between 1976 and 1982.

A former Wilson employe who became a government informer, Kevin P. Mulcahy, was found dead at an isolated motel in rural Virginia last fall, a victim of what a medical examiner said were natural causes. A Cuban exile linked to an alleged, Wilson-inspired hit squad died in a Florida boat explosion. Authorities ruled the blast was an accident.

If convicted, Dubberstein would have faced up to 57 years imprisonment and $80,000 in fines. Greenberg said in court that Dubberstein had at least $225,000 in assets, and had traveled to the Middle East within the last 60 days.

Another prosecutor, William C. Hendricks III, said Dubberstein was not under government surveillance because he had kept previous appointments with investigators, including one a week ago when he surrendered personal financial records to the grand jury investigating him.

One of Dubberstein's defense lawyers, Howard Bushman, said last night on the ABC-TV "Nightline" program that Dubberstein had been "very upset. This had been a very hard situation for someone 75 years old to take, who's dedicated his entire life to service to the American people and to our government . . . . There's absolutely no motive here of selling out his country . . . . He was in a no-win situation."

The CIA confirmed yesterday that Dubberstein worked for the agency from 1947 to 1971, when he left for the DIA. The indictment said that while at the Pentagon, Dubberstein had access to classified information, including nuclear weapons design and U.S. war plans.

He was charged in seven counts with conspiracy, unauthorized disclosure of classified information and bribery. The grand jury alleged Dubberstein turned over sensitive summaries and analyses of Middle East affairs beneficial to Libya both to Wilson and directly to Libyan intelligence officers. The indictment alleged he received more than $32,000 from Wilson in return.

After providing secret material to Wilson during much of 1978, the indictment said, Dubberstein, traveling under a false name, visited Libya and met on four or five occasions with Libyan intelligence officers. At the time, Libya had close ties with the Soviet Union and was frequently near open hostilities with Egypt, its North African neighbor.

Shortly after the Libyan trip, the grand jury charged, Dubberstein met in Europe with Wilson and received a $25,000 cash payment for his efforts. A source said last night that Dubberstein's German-born girlfriend accompanied him on the trip.

The woman appeared twice in the last year before the federal grand jury investigating Dubberstein's alleged dealings, the source said.

As a defense employe with access to top military secrets, Dubberstein was subject to department restrictions on his travels outside the United States and was required to report contacts with certain foreign nationals, as well as any outside employment either paid or unpaid.

Wilson, who is under sentences totaling 32 years, still faces trials on alleged explosives exports to Libya and allegedly trying to arrange the murders of federal witnesses and two Washington prosecutors.