Dalrymple was a friend of both James Boswell and his father Alexander Boswell and occasionally acted as a mediator between them.
JB respected him highly, and in his journal of February 10, 1763, wrote "I [...] wrote to him, telling him how my affairs went on, and that I wanted to be rationally happy, yet easy and gay, and hoped he would take a charge of me; would let me know what books to read, and what company to keep, and how to conduct myself." , and that he (Boswell) considered Dalrymple "a representative of Mr. Addison". Boswell was referring to Joseph Addison (1672-1719), publisher of The Spectator (1711-1712), a periodical which Boswell had read and admired much.
When he received a positive response from Dalrymple it gave him "much satisfaction and a good opinion of myself, to find that a man of so much true worth and even piety had my interest at heart and was willing to keep a correspondence with me."
In a letter to Boswell of December 2, 1763, Dalrymple described his own state of mind as follows: "I am happy; I go my way in peace; I apply myself to the duties of society, and in filling the empty places of my brain with useful studies, I close it to metaphysical chimeras. Do thou likewise, my dear friend, and be happy; as happy as your very humble and most affectionate Dav: Dalrymple".
[1764-1766 ?]
On August 29, 1766, Dalrymple sent Boswell advice on his plans to publish an account of his journey to Corsica in 1765. Concerning the name of Pasquale Paoli he wrote "Paschal is more pleasing to an English ear than Pasquale" and probably remembering Boswell's publishing schemes of the early 1760s - and still referring to Paoli - he continued "remember he is the chief figure, he must come forward; the others, even yourself, must keep back."
On August 17, 1773, Dalrymple came to dinner at Boswell's in Edinburgh, during Dr Johnson's stay there, shortly before Boswell and Johnson set out on their tour of Scotland. Also present were Sir Alexander Dick, John Maclaurin and Dr James Gregory. According to Boswell, in Journal of a Tour to the Hebrides, "[Dalrymple], who is one of the best philologists in Great Britain, who has written papers in the World, and a variety of other works in prose and in verse, both Latin and English, pleased [Dr Johnson] highly." He went on to describe their conversation in some detail, including how Dalrymple was able to point out passages by Dr Johnson in a law paper otherwise ascribed to Boswell.