“Pain and Glory” marks Pedro Almodóvar’s 21st movie. And, like...

A man allegedly tried to rob a Long Island liquor store with a sword — only to be fatally gunned down by a store employee Thursday, police said.

The foiled robbery happened just before 2:30 p.m. at Port Jeff Liquors in Port Jefferson, when the man entered the store and began swinging around a sword, Suffolk County cops said.

The employee then whipped out a firearm and blasted the blade-wielding bandit, authorities said.

The robber, who was not identified, was pronounced dead at the scene.