The Staten Island driver who plowed his car into the side of a house Friday told a criminal-court judge yesterday he was neither drunk nor high on prescription medication when he lost control of the car, blaming it on a medical condition.

Wearing baggy jeans and a ripped, white v-neck T-shirt, Charles Trainor, 22, pleaded not guilty yesterday to four charges, including vehicular assault and including one count of DWI, in a horrific accident that nearly killed a sleeping mom and her young child.

“I’m assuming he had a seizure at the time because of the events,” said Yan Katsnelson, Trainor’s attorney. “He was not under any influence of drugs or alcohol.”

Trainor blew a .07 on a Breathalyzer test at the scene and a .024 at the stationhouse — below the legal limit — but failed a sobriety test, a source told The Post. Trainor told cops he was on Keppra seizure medication at the time of the accident, the source added.

Trainor crashed into the box-shaped Arthur Kill Road home on Friday just after 4 am., where Lisa Roman and her five-year-old daughter Leonora were sleeping on a pullout couch in the kitchen. The two were pulled from under Trainor’s 2010 Hyundai Elantra and rushed to Staten Island University North Hospital.

Roman suffered third-degree burns on her upper body and her daughter sustained a fractured skull and eye sockets, according to Assistant District Attorney Kirsten Kruger.

Josette Roman, 17, said her mother and younger sister were recovering.

“We ask everyone to keep praying,” she said.

Trainor was released on bail and left Stapleton Criminal Court just before noon yesterday. He ran out the courthouse with his head down and swaddled by a grey, hooded sweatshirt, ignoring questions from reporters about the incident and refusing to say whether he had a history of seizures.

He jumped into a white Ford Focus with Pennsylvania plates and sped off, but not before the driver yelled at the press, “Get the hell out of here.”

The Roman house had suffered another vehicle crash a decade earlier when Philip Cutler, 20, plowed his car into the home, then occupied by an ailing grandmother.