Suffolk County Police say the shooting happened at about 4 p.m. Wednesday in West Babylon.
The man was taken to a hospital. His condition was not released, but the injuries were described as not life threatening.
Police say officers went to the Dunkin' Donuts after a call of a suicidal woman.
When they arrived they tried to take a woman into custody, but a man came in and intervened.
Police say a struggled ensued and the man was shot by a police officer.
The officer involved in the shooting was also hospitalized as a precaution.
No one else was injured. It was not clear if the man and woman were connected.
The investigation is continuing.