An investigation into alleged favoritism in the Maryland State Police promotion system has prompted three high-ranking police officials to retire rather than face administrative charges.

Results of the state probe, which will be presented to a legislative subcommittee in Annapolis Wednesday, allege that the three officials tampered with promotion scores during 1983 and 1984 to help favored officers advance in the department, according to a knowledgeable source.

A state police spokesman said Lt. Col. William Gerwig, 52, chief of the division that oversees the police academy and one of the department's top five officials, will retire Dec. 1, as will Maj. Robert Cave, 50, assistant chief of special operations.

A third official, Capt. Edward Peach, 53, who oversees the section that reviews barracks operations, is to retire on a date not yet set.

All three have been with the department long enough to qualify for full pensions. None could be reached for comment today.

The state attorney general's office began the investigation into allegations of score tampering last year, and the probe was taken over last spring by the Baltimore Police Department.

A state source familiar with the investigation said the officials are alleged to have rigged scores of a half-dozen or more officers, raising some and lowering others. The source said that if Gerwig had not agreed to retire, he would have been charged with altering Cave's score to enhance Cave's chances of being promoted to major.

Cave and Peach would have faced charges of tampering with the scores of subordinates, the source said. Peach was also accused of violating department rules in his treatment of Bernard T. Haywood, the officer who first raised charges of score tampering in 1981.

Col. Wilbert T. Travers Jr., 51, who resigned as police superintendent two weeks ago, was hired in 1982 with a mandate from Gov. Harry Hughes to clean up alleged promotion system abuses.

Travers was criticized for failing to end the alleged abuses in a report issued last spring by Attorney General Stephen H. Sachs.

Travers' replacement, George B. Brosan, 51, a former official of the Drug Enforcement Administration, took over as police superintendent this week. He has said his top priority will be to resolve the department's "management problems."

The three police officials were informed by the state attorney general's office Friday that they would face administrative charges that could lead to dismissal, a state source said. They were given the option of retiring, and were given until 2 p.m. Monday to decide whether to do so.