A federal grand jury will investigate an alleged "potentially criminal" award of a contract that could be worth up to $9.9 million to a Pittsburgh firm for a computerized mailing system for the Senate, a Justice Department official said yesterday.

Assistant U.S. Attorney William Block also said the grand jury will look into a $7.5 million contract awarded by the Department of Health, Education and Welfare to the company, On-Line Systems, Inc.

On-Line President Jack Roseman and Chairman John Godfrey were away from their Pittsburgh offices and not immediately available for comment.

Senate officials signed a three-year contract with On-Line May 22, but the system must survive a performance test before it will be accepted fully by the Senate Rules Committee. If the system proves out, the contract could be extended five more years on a year-to-year basis.

On-Line won the contract to link individual Senate offices to a central computer system to give replies to letters a personal touch. It is designed to produce up to a million letters a month, making each appear to be an individual response.

Some sources have alleged favoritism in the awarding of the Senate contract, which went to On-Line after competitive bidding.

"We are investigating allegations concerning possible improprities in the awarding of computer, programming contracts at both HEW and the U.S. Senate," Block said in an interview. "Those allegations are of a serious enough nature that they could be potentially criminal."

Edwin Parker III, a former HEW computer project manager, was dismissed Aug. 1 for allegedly accepting more than 200 meals and trips to pro football games from On-Line. The gratuities were discovered by HEW investigators.

Parker was in charge of a computerized tracking system for the guaranteed student loan program in the U.S. Office of Education. On-Line won the $1 million contract, which later ballooned to $7.5 million.

The contract was approved without a vote by the full Senate under a procedure that allows the Rules Committee to pay for "miscellaneous" items.

If On-Line fails to meet performance standards during its test period, which must begin by late September, the Senate can terminate the agreement.

Informed of the investigation, Bill Cochrane, the committee's staff director, said, "I don't think we have anything to worry about that. I have absolute confidence in our people."