A former employe of the House doorkeeper's office was sentenced yesterday to one year probation on charges of possession and conspiracy to possess cocaine.

James Beattie, 27, of Alexandria, pleaded guilty last May to the charges. The plea was ordered sealed until the sentencing. Beattie has been cooperating with Justice Department and House Ethics Committee investigators probing allegations of drug use on Capitol Hill.

Beattie, who said in court that he was forced to resign after eight years in the doorkeeper's office, is the second person to be sentenced in the Capitol Hill probe sparked 15 months ago by the arrests of two Washington area men.

Robert T. Yesh, another veteran employe of the doorkeeper's office, was sentenced last April to one year in prison after he pleaded guilty to conspiracy and possession with intent to distribute cocaine.

U.S. District Court Magistrate Jean F. Dwyer told Beattie, who faced a maximum two years in prison and $20,000 in fines, not to think that by imposing probation rather than a prison term she was "downgrading the severity of the offense you committed." Dwyer said the offense was "one blot on an otherwise impeccable record."

Assistant U.S. Attorney Daniel J. Bernstein said Beattie's conduct was "unlawful and abhorrent" because he was "trafficking" in drugs in the Capitol. Bernstein said Yesh was "a customer" of Beattie's, but that Beattie had not distributed drugs to congressmen, "only to his peers, including other employes in the doorkeeper's office."

Bernstein said the government had refused a request from Beattie for immunity from prosecution in return for his cooperation. That decision came in part because of the "location and nature of the offense," Bernstein said, adding that despite Beattie's cooperation, the offense merited some period of incarceration.

Dwyer, who received a letter from Joseph Califano Jr., House Ethics committee special counsel, outlining Beattie's extensive cooperation with the probe, told Beattie that the "damage you have done to yourself, your friends and family was far greater than your worst enemy could have done."

Dwyer said Beattie, who now works for a computer company in Virginia, must perform 100 hours of community service as part of his probation.

Beattie's attorney, Rosalyn Mazer, told Dwyer that Beattie recently had testified to the House Ethics Committee and "gave them information not previously known to investigators."

The two men whose arrests last year sparked the federal and congressional drug investigations, Troy M. Todd Jr. and Douglas W. Marshall, have pleaded guilty to drug trafficking charges and are expected to be sentenced in late August.

As part of the investigation begun after Todd's and Marshall's arrests, the Justice Department has been examining allegations that three congressmen used drugs. Sources close to those investigations say the probes are essentially completed, and a decision is expected soon from Attorney General William French Smith on whether to seek grand jury indictments.

The three, former Rep. Barry Goldwater Jr. (R-Calif.), Rep. Ronald V. Dellums (D-Calif.) and Rep. Charles Wilson (D-Tex.) have consistently denied allegations that they have used cocaine.

Meanwhile, Senate Ethics Committee Chairman Ted Stevens (R-Alaska) told United Press International yesterday that his committee had turned over to the Justice Department some allegations of drug use or sexual misconduct by Senate employes that had come up in connection with the just-concluded House investigation that produced the censure of two House members for having sexual relations with pages. None of the allegations involved senators, Stevens said.