A Virginia judge ruled yesterday that the director of an Alexandria-based anticommunist foundation that allegedly received stolen police intelligence data must appear before a California grand jury later this month to answer a subpoena requiring her testimony and the missing files.

Attorneys for Linda Guell, head of the Western Goals Foundation, founded in 1979 by the late Rep. Larry McDonald (D-Ga.), said their client does not have any of the 60,000 documents investigators contend were stolen from a special unit of the Los Angeles Police Department. McDonald was among 269 people killed two weeks ago in the Soviet attack on Korean Air Lines Flight 007.

A Los Angeles police detective is suspected of leaking the data, contained in computer tapes and printouts, to Western Goals to establish dossiers on persons suspected of being political subversives, and on left-wing individuals and organizations, according to court testimony.

Guell's lawyers stressed yesterday that neither Guell nor Western Goals is a target of a 10-month police investigation of how the materials were removed from the now-defunct Public Disorder Intelligence Division.

"We are disappointed with the court's decision," said attorney Harvey B. Cohen, who had asked Alexandria Circuit Court Judge Albert H. Grenadier to block the subpoena. Cohen said yesterday's ruling will be appealed to the Virginia Supreme Court. Guell declined to comment.

Cohen said yesterday that unless Guell is granted immunity from prosecution, she will invoke her Fifth Amendment right not to testify before the grand jury at her appearance, scheduled for Sept. 29.

A second Western Goals employe, editor John Rees, is scheduled to appear in a Baltimore courtroom this morning in a similar hearing to determine if he must appear before the same California grand jury.

Cohen underscored testimony yesterday in Grenadier's courtroom by a Los Angeles detective investigating the case that Rees, and not Guell, is believed to have the files.

Deputy Los Angeles District Attorney Denis Petty maintained that Guell's testimony is necessary to the case, which centers on Detective Jay S. Paul, a former member of the now-disbanded police intelligence unit. Los Angeles Detective Ben Lovato testified yesterday that his investigation showed that Rees removed the files--most of them stored on 30 computer tapes--from Paul's home "under the direction of Linda Guell."

Petty also submitted a contract for $30,000 a year in computer services that the prosecutor said linked Guell to Paul through Paul's wife, Ann Love. Lovato said his investigation showed that Paul used his wife's Long Beach law office to set up a computer terminal purchased by Western Goals. The terminal was used to create a data bank containing information about suspected Communists and left-wing groups, Lovato testified.

Lovato testified that Paul has maintained he was authorized to share the data with Western Goals. Paul did not want his name on the computer contract because of "his association" with the Los Angeles police department, according to Lovato.

A 1943 California law makes it a felony to remove official government documents without authorization.

Guell's attorneys said much of the missing material is not sensitive and contains newspaper and magazine articles on individuals and organizations.

But investigators said even the leaking of seemingly harmless information could jeopardize confidential police sources.