The Minstermen have been forced to limit the attendance, and restrict ticket sales to home fans, for the game in order to obtain a safety certificate for increased crowds at their new stadium.
Steve Bruce's men will make their first ever visit to the LNER Community Stadium on Saturday, July 18th for a 2pm (BST) kick-off, as well as taking on League Two side Harrogate Town on the same day, with the United head coach splitting his first-team squad for the two matches.
York are managed by former Newcastle man Steve Watson and the National League North side moved into the 8,500-capacity ground - which is owned by City of York Council, and is shared with rugby league side York City Knights - in February.
The attendances for York's home friendlies against Sunderland and Middlesbrough have also been capped, in line with requirements from City of York Council and the Stadium Advisory Group.
However, York are planning to stream the game against United on their official YouTube channel, with donations encouraged via a 'virtual turnstile.'
As well as the double-header with York and Harrogate, the Magpies have confirmed away friendlies against Rotherham United on Tuesday, 27th July (kick-off 7pm BST) and Burton Albion Friday, 30th July (kick-off 7.45pm BST).
Ticketing information for those friendlies - along with details of further pre-season matches - will be confirmed on nufc.co.uk in due course.