Members of An Garda Síochana were called to reports of a disturbance in Stocking Lane in Rathfarnham at around 12:30am yesterday morning.
When they arrived, they witnessed a man approaching them while brandishing a gun, but he then threw it over a wall and ran from the scene.
Gardaí then recovered the gun and arrested a 20 year-old man.
He was questioned at a Garda station on the north side yesterday and has since been charged.
He's due to to appear before a sitting of Tallaght District Court at 10:30am this morning.