A plainclothes NYPD captain was beaten up in a near-robbery Thursday while on the job in Manhattan, cops said.

The captain was investigating a case near Tenth Avenue and West 41st Street around 6:30 p.m. when an unidentified man approached him on the sidewalk and blocked his path, police said.

“What you got? What you got?” the suspect asked him, according to cops.

Another man came up from behind, grabbing the captain and punching him in the face, cops said.

The pair of thugs then ran off in an unknown direction, police said.

The cop was in stable condition after the assault, cops said.