Allan Johnston's men cruised into the hat with a 5-1 demolition of derby rivals Cowdenbeath on Saturday and their reward is a tie at home to Paul Hartley's high-flying Dees.
The Dark Blues top the Scottish Premiership after a thumping 4-0 win at Kilmarnock on the opening day and they were the highest ranked team in the draw, which was seeded.
Dunfermline, who begin their League One campaign at Brechin City on Saturday, last met their opponents during their victorious First Division season of 2010/2011, where they were unbeaten in four games with the Dens Park men.
The tie will be played on 25th or 26th August.
The full second round draw is: Ross County v Ayr United Forfar Athletic v Heart of Midlothian Kilmarnock v Berwick Rangers Raith Rovers v Hamilton Academical Queen of the South v Morton Dunfermline Athletic v Dundee Partick Thistle v Falkirk East Fife v Motherwell Hibernian v Stranraer Airdrieonians v Rangers St Mirren v Livingston.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here