An agreement has been reached that would cut short a controversial hearing at the El Toro Marine base in which a high-ranking officer was accused by a Marine Corps defense lawyer of sexual harassment and intimidation of witnesses. But whether the agreement is accepted is up to top Marine Corps officials in Washington. A spokesman there has said that it will probably take three to four weeks to decide. At stake is the question of whether a Marine--in this case Lance Cpl. Sonia M. Kourchenko--should be given something less than an honorable discharge. She has admitted using marijuana while assigned to the air station at El Toro, and her commanding officer, Lt. Col. Thomas F. O'Malley Jr., has recommended an "other than honorable" discharge. Kourchenko's attorney has charged that O'Malley participated in and permitted sexual harassment of women and used threats and trumped-up charges to intimidate witnesses in drug-related cases.