A rookie NYPD officer who had just gotten off the night shift was killed Wednesday in a head-on collision with a garbage truck in the Bronx.

The crash happened around 8:20 a.m. along Shore Road, a winding thoroughfare that cuts through Pelham Bay Park and leads to Westchester County.

Brian Kessler, who graduated from the police academy in October, was heading northbound and approaching a curve in the road when his silver 2013 Chevy Equinox suddenly swerved, slamming directly into the oncoming Parks Department truck.

Kessler was on his way to his home in New Rochelle after working the 7 p.m. to 7 a.m. on security detail at 1 Police Plaza — an extra overtime shift that all officers are asked to pull, police sources said.

The 28-year-old, who was engaged to be married, spent three months assigned to Police Service Area 8, which serves NYCHA buildings in the 43rd and 45th precincts in the Bronx, police said.

“He’s well-liked. A lot of his colleagues are distraught, as can be expected,” NYPD Chief of Housing James Secreto said at a press conference at Jacobi Hospital.

Ralph Dilone, the superintendent of Kessler’s apartment building on Centre Street, said the young officer’s dream was to wear an NYPD badge.

“His goal was to be a police officer and he finally made it. He was extremely hard working,” said Dilone, 55, who retired from the NYPD’s organized crime unit in 2016.

“He was totally dedicated to his position as a police officer. He loved his job. It was what he dreamed of.”

The impact of the crash turned Kessler’s SUV into a crumpled heap of metal and left the windshield and driver’s side window smashed, while the garbage truck also sustained front-end damage. A police helmet was strewn in the brush.

Kessler had to be extricated from the wreck by the FDNY, said Larry Nikunen, commanding officer of Patrol Borough Bronx. He was given CPR en route to Jacobi but pronounced dead at 9:15 a.m.

At the hospital, Kessler’s heartbroken parents and fiancee, Denise Vargas, were escorted down a hallway among at least two dozen of his grim-faced colleagues, who stood at attention.

Sources said Vargas was “inconsolable” at the hospital.

The couple was inseparable, Dilone said.

“I don’t know how [she] is gonna accept that,” he said about Kessler’s death. “They have so many plans. They do everything together. You never saw one and then the other. You always see the two of them.”

Two Parks Department employees who were riding in truck suffered minor injuries, one to the head and the other to the chest. They were also taken to Jacobi.

Police said it appeared the truck was moving at the time. It wasn’t immediately known if Kessler tried to brake.

The accident, which occurred near the Pelham Bay & Split Rock Golf Courses, is under investigation. No criminality is suspected.

Vargas didn’t return a message.

“We are deeply saddened at the loss of our brother Police Officer Brian Kessler in this tragic accident,” Police Benevolent Association President Pat Lynch said in a statement.

Additional reporting by Alex Taylor and Cedar Attanasio