Just after lunchtime on Dec. 22, 1988, D.C. police Detectives Pierre Mitchell and Robert Thompson broke off an investigation, only hours in the planning. It was to be an undercover attempt to purchase cocaine from a guest at the downtown Ramada Inn. His name: Charles Lewis.

The failed "buy-bust," in police parlance, was anything but routine. The hotel manager testified last week that he called it off because he realized that Mayor Marion Barry was visiting Lewis in his ninth-floor room when the detectives were on their way to the room.

By chance, a source familiar with the incident called The Washington Post soon after the detectives aborted the investigation. Within a couple of hours, a Washington Post reporter was talking with Lewis at his door.

Lewis was unaware of how close he had come to being arrested. Earlier in the day, before Barry arrived, Lewis had offered cocaine to Carmen Alarcon, a hotel maid, he later testified.

Alarcon had told her supervisor about the offer, and the supervisor had called police.

Reporters also questioned Deputy Chief Edward J. Spurlock at 3rd District police headquarters, but Spurlock also was unaware of what had occurred. By late that evening, however, then Police Chief Maurice T. Turner Jr. had ordered an internal investigation.

In the days that followed, news accounts reported that Barry had visited the hotel not once, but numerous times in the week before Dec. 22.

Barry at first denied visiting Lewis more than once, then confirmed the multiple trips to the hotel. All the while, the mayor offered differing reasons for going to see Lewis, while denouncing the detectives, the maid and the media.

Barry said he went to see his friend because Lewis was down on his luck

and looking for a job.

Later, Barry said he went to deliver a copy of Indices, a city government publication about D.C. agencies. With each explanation came a Barry denial that he had used drugs at the Ramada Inn, or anywhere else.

Within a few weeks, Barry incorporated this general denial into speeches everywhere he went.

Surprised city residents attending a public hearing on the overhaul of the Whitehurst Freeway during this time heard the mayor interrupt his talk about the highway to say he had never used illegal drugs.

In March 1989, Lewis was arrested at a luxury hotel in the Virgin Islands and charged with possession and distribution of cocaine. He had been caught in an FBI sting operation, captured on audio tape providing crack to an undercover agent.

A month later, just before he was to stand trial in the Virgin Islands, Lewis was charged again.

These charges came from the grand jury here, alleging that he had distributed cocaine, and that he lied when he testified he had not used drugs at the Ramada.

Lewis was convicted on the Virgin Islands charges and was ordered held without bond when he returned to face the drug and perjury indictment here.

After spending almost three months in the Alexandria detention center, he agreed to cooperate with the government and instantly became the key witness against the mayor.

With Lewis's cooperation, investigators were able to make sense of dozens of leads they had accumulated during the previous eight months, and before the end of 1989, they were ready to ask U.S. Attorney Jay B. Stephens to seek an indictment.

Weeks later the agents made an unexpected breakthrough. Early on New Year's Day, 1990, a police officer in suburban Los Angeles pulled over a car in a routine traffic stop.

A police computer revealed the driver to be a witness whom the FBI was seeking, a woman whom FBI informant Lewis had known only as "R.C." The woman was Hazel Diane "Rasheeda" Moore, a former girlfriend of Barry's who had accompanied the mayor to the Virgin Islands.

Earlier in 1989, Moore had testified before a grand jury here that she knew nothing about Barry's alleged drug use, but after FBI agents visited her in Los Angeles she quickly decided to cooperate.

Within days, the FBI had Moore back in Washington, where she lured Barry to her room at the Vista Hotel on the first night she tried. After about an hour in the room, Barry raised a crack pipe to his mouth, inhaled twice and started to leave.

Just as he turned to walk out the room, police and FBI agents burst in and placed Barry under arrest.

The arrest, which authorities have described as a direct product of the Ramada Inn episode, in turn produced the 14-count drug and perjury indictment for which Barry is now on trial.