Brad Tristan Plummer, from Killinghall, denied the accusation when he appeared at York Crown Court today (Thursday, December 23).
The alleged offence is said to have occurred at the Nelson Inn on Skipton Road, Killinghall, on September 29 last year.
The prosecution claims that Plummer intended to cause a named man fear of violence with a BB gun.
He denies this.
Judge Simon Hickey adjourned the case for a trial on July 18 next year.
Plummer, of Skipton Road, was granted unconditional bail until that date.