A woman was slashed by stranger who greeted her with a “hello” outside a Whole Foods in Brooklyn Monday night before a store security guard stepped in and detained the man, police said.

The suspect, identified by police as Rodney Robinson, 21, approached the woman from behind while she was loading groceries into her sister’s car around 9:30 p.m. in the Whole Foods parking lot on Third Avenue near Third Street in Gowanus, cops and a witness said.

“Hello,” Robinson said, before slashing her in the left hand with a knife, cops said.

The 53-year-old woman jumped into the car and reverse out of the parking spot, authorities said.

“As soon as I heard the scream, she reversed and pulled out — fast,” a witness who asked not to be named said. “I thought like no regard — she’s just trying to get the freak out of there.”

An armed store security guard saw the attempted robbery and intervened — training his gun on the suspect and detaining him until police arrived.

“He told people to call 911,” the witness said of the security guard.

The suspect was taken into custody at the scene.

Robinson, who is from Philadelphia, was arrested at the scene and charged with assault and criminal possession of a weapon. A knife was recovered at the scene, cops said.

The victim went to Brooklyn Methodist Hospital with non-life threatening injuries.

Additional reporting by Ben Feuerherd