LARGO, Fla. (AP) _ A nurse who allegedly claimed to have killed as many as 23 nursing home patients pleaded guilty today to killing three elderly patients with lethal drug overdoses.

Under a plea agreement, Brian K. Rosenfeld was sentenced to three concurrent life terms with no chance of parole for at least 25 years.

Although Rosenfeld was charged in only three deaths, former cellmate David Greenway told investigators he admitted killing as many as 23 patients, according to court documents.

In five years, Rosenfeld worked at 14 nursing homes where 201 deaths occurred. He was fired or let go from most, sometimes because employers thought he mistreated them.

Rosenfeld, 34, stood before Pinellas County Judge Claire K. Luten today answering simply ''yes, ma'am'' and ''no, ma'am'' as she quizzed him extensively about whether a decision to switch his plea from innocent was his own and that he understood the consequences.

In his plea to three first-degree murder charges, Rosenfeld admitted overdosing two elderly women and one man with Mellaril, an anti-anxiety drug.

Defense attorney Larry Hoffman said he was preparing for trial when Rosenfeld contacted him about three months ago, asking him to seek a deal with the state if he would plead guilty.

As part of the plea, which was accepted by the judge, the state guaranteed there were no additional investigations at this time involving nursing home deaths while Rosenfeld was on duty.

However, should Rosenfeld boast in prison at some time in the future that he killed other patients - and the state finds out - there's nothing to preclude the state from pursuing additional charges.

Investigators collected reams of documents as they probed dozens of nursing home deaths, examined records of each shift and each job Rosenfeld worked, exhumed several bodies and interviewed numerous witnesses and colleagues.

A licensed practical nurse once quoted him as saying some elderly patients would be better off dead because they were ''nothing more than vegetables,'' investigators said.

Rosenfeld had been set for trial later this month on a single first-degree murder charge in the July 29, 1990, death of Muriel Watts, 80, a comatose patient at Rosedale Manor nursing home.

Last month, Rosenfeld, who has been in custody at the Pinellas County Jail without bond since August 1990, was indicted in the overdose deaths of two more patients: Hazel DeRemer, 81, who died in July 1987, and Alphonse Silva, 76, who died in May 1990.

Joan Wood, chief Pinellas medical examiner, said 201 patients died at various nursing homes where Rosenfeld worked. But 171 of the bodies were cremated, leaving 30 for possible analysis and testing, she said.

Because of high investigative costs and the patients' conditions, only five bodies were exhumed. Tests on two of the five - Silva and DeRemer - showed Mellaril, Wood said.