Dorchester entered the competition in the First Qualifying Round and have defeated Yate Town, AFC Totton, Hungerford Town and Eastbourne Borough to get to this stage.
The Magpies are currently 16th in the Evo-Stik Southern Premier Division South.
Barnet were 3-2 victors over Bath City at the weekend and booked their spot in the Second Round.
The tie is scheduled to take place on Saturday 12th January 2019. Ticket details will follow in the near future.