Kerry Kennedy swerved her Lexus into a truck, damaging the car and blowing a tire, but kept driving and later was slumped at her steering wheel and disoriented, motorists testified Monday at her drugged-driving trial.

Her lawyer said she was “sleep-driving” because she had accidentally taken a sleeping pill.

Kennedy, ex-wife of New York Gov. Andrew Cuomo, daughter of Sen. Robert F. Kennedy and niece of President John F. Kennedy, went on trial Monday in suburban New York.

Several Kennedy relatives, including her mother, Ethel Kennedy, sat in the gallery’s front row.

In his opening statement, defense lawyer Gerald Lefcourt told the six jurors that Kennedy was not disputing that she drove erratically. But he said it happened because Kennedy accidentally took an Ambien sleeping pill that morning instead of her thyroid medication.

Kennedy’s blood tests revealed a small amount of the sleeping drug zolpidem.

“The zolpidem kicks in. It shuts her down. She’s in a state of sleep-driving,” Lefcourt said.

Prosecutor Stefanie DeNise said even if the pill were taken accidentally, Kennedy violated the law “by failing to stop and pull over as she felt the onset of symptoms.”

But Lefcourt said Kennedy never knew what the drug was doing to her. He said the medication “hijacks your ability to make decisions.”

Kennedy was arrested in 2012 after her car hit a tractor-trailer on an interstate highway near her home outside New York City. She drove to the next exit, where she failed three of four sobriety tests, police said.

One fellow motorist, Henry Myers, of North Salem, said he saw Kennedy swerve her car into the tractor-trailer on Interstate 684 and keep driving despite damaging her tire.

“I saw smoke. I figured the car would stop,” he said. When it didn’t, he called 911.

Another driver, William Carlino, of Armonk, testified that a few minutes later he found Kennedy slumped over the wheel and disoriented, with the car running, in a left-turn lane on Route 22. Carlino said her car had one wheel without a tire.

He said he ran from his car to hers and knocked on her window, which seemed to startle her.

“I asked if she was OK and she nodded in the affirmative,” he testified. He also called police. After police arrived and questioned her, she sat barely moving in the back seat of a cruiser, according to police video shown to the jurors Monday. Lawyers for both sides said she was sleeping.

Ethel Kennedy, 85, walked slowly with an escort as she entered the courthouse. After the session, in late afternoon, she left in a wheelchair. Two of Kerry Kennedy’s brothers, Robert Kennedy Jr. and Douglas Kennedy, also were in the courtroom.

The case was being heard in state Supreme Court, a rarity for such a minor charge, but Kennedy’s lawyers successfully argued that the Town Court in Armonk, which had jurisdiction, was too small and poorly equipped for the trial.

A town judge and a state judge both refused defense efforts to get the charge dismissed, despite warm letters from family and friends extolling Kennedy’s work in human rights around the world.

Kennedy, 54, of Bedford, won permission from Justice Robert Neary to miss last week’s jury selection because she was on a human rights trip to Western Sahara.

The trial is expected to last about a week.

Join our Newsletter for the latest news right to your inbox