The match will be played at Glanford Park in the week beginning Monday August 9.
It will be one of the first tests of new Oldham manager Paul Dickov, who took charge of the team last week.
Dickov said the game would give him a good yardstick to measure the progress made under him.
"Obviously we would have preferred a home draw, but you have to take what you are given," he told Oldham's official website.
DRAW IN FULL:
Northern section: Hartlepool United v Sheffield United, Leicester City v Macclesfield Town, Walsall v Tranmere Rovers, Carlisle United v Huddersfield Town, Stockport County v Preston North End, Barnsley v Rochdale, Morecambe v Coventry City, Doncaster Rovers v Accrington Stanley, Chesterfield v Middlesbrough, Peterborough United v Rotherham United, Bradford City v Nottingham Forest Leeds United v Lincoln City, Sheffield Wednesday v Bury, Scunthorpe United v Oldham Athletic , Crewe Alexandra v Derby County, Exeter City v Ipswich Town.
Southern section: Southend United v Bristol City, Southampton v AFC Bournemouth, Brentford v Cheltenham Town, Queens Park Rangers v Port Vale, Torquay United v Reading, Norwich City v Gillingham, Stevenage v Portsmouth, Shrewsbury Town v Charlton Athletic, Cardiff City v Burton Albion, Northampton Town v Brighton & Hove Albion, Swansea City v Barnet, Plymouth Argyle v Notts County, Wycombe Wanderers v Millwall, Oxford United v Bristol Rovers, Milton Keynes Dons v Dagenham & Redbridge, Hereford United v Colchester United, Yeovil Town v Crystal Palace, Aldershot Town v Watford, Swindon Town v Leyton Orient.