 David Dalrymple was the fifth and youngest son of James Dalrymple, 1st Viscount of Stair and his wife Margaret Ross, daughter of James Ross of Balneil, Wigtown.He was educated at the University of Edinburgh and was awarded MA in 1681, and then studied at the University of Utrecht in 1682.He was admitted a member of the Faculty of Advocates on 3 November 1688.