Hi - I've been researching Thomas Dalrymple, too, and struggling to find his parents. I descend from Thomas Dalrymple & Alison Mitchel, through their son William (b. 14 April 1780, Larbert, Stirlingshire), who married Ann Ferguson, etc. William's birth record is on ScotlandsPeople.
In many trees, Thomas is listed as born in 1752 at Polmont. There are two marriage-related records on ScotlandsPeople for Thomas Dalymple and Alison Mitchel: (1) Proclamation on 6 January at Denny, Stirlingshire, Scotland, where it lists Thomas Dalrymple in this parish [Denny] and Alison Mitchel in the parish of Polmonton; and (2) The record saying they were married on the 24th of January 1772 in Polmont.
I haven't found any connection to Thomas born to John, the 5th Earl of Stair as his father, apart from seeing it in online trees, with no source shown.
John was married to Margaret Middleton (the daughter of George Middleton of Erroll and Mary Campbell) on 19 May 1748 at Middlesex, Westminster, England. This couple also had a daughter, Mary (baptized 3 June 1754).
In the Dictionary of National Biography, Volumes 1-22, it states on page 423 that "By his wife, a daughter of George Middleton, banker, London, he had one son [q.v.], John, who succeeded him as 6th Earl," but on page 425, it goes on to describe this son, stating "DALRYMPLE, JOHN, sixth Earl of Stair, eldest son of John, fifth Earl of Stair (1749-1821), and his wife, a daughter of George Middleton, banker, London, was born 24 September, 1749." The fact that John (the 5th Earl) was first said to have one son by his wife [Margaret], and then this son is referred to as his eldest son is a curious thing, and one could surmise that the 5th Earl had one or more additional sons, perhaps by another woman; son(s) born out-of-wedlock.
I've seen the familysearch reference to the parents of Thomas listed as John Dalrymple (1720-1789), the 5th Earl of Stair and a Sarah Goodale (b. 1718-1765), in addition to a public member tree on Ancestry with the parents of Thomas listed as the 5th Earl of Stair and a Sarah Stewart (b. 2 Aug 1718, Ayr, d. 1765). MyHeritage has a reference to Thomas being born circa 1741, and his father as being a James Dalrymple born on November 4 1789, at Falkirk, Stirling, Scotland. No source material cited. No sign of a Sarah Goodale, Sarah Stewart, or James Dalrymple with those birth dates on ScotlandsPeople.
https://ancestors.familysearch.org/en/LHK4-WWT/thomas-dalrymple-1752-1810https://www.ancestry.com/family-tree/person/tree/81385736/person/142460679914/factshttps://www.myheritage.com/names/thomas_dalrympleI am not sure how Sarah materialized or was ever linked to John, the 5th Earl of Stair, as seen in online trees. Granted if she was a Mistress, source materials would be difficult to come by, but one wonders how one would even know that her name was Sarah, let alone her birth and death dates.
The only record that I was able to find for a possible Thomas Dalrymple born to a John Dalrymple and a woman named Sarah in that time frame was a baptismal record (Ancestry) on 30 October 1757 for a Thomas Dalrymple, parents John Dalrymple and Sarah his wife, at St. Mary Magdalen Bermondsey, Southwark, Surrey, England, with the remarks Jacobs Street, Waterman [John's occupation]. The couple also had a daughter, Elizabeth, baptized on 29 April 1760 at that parish, with the same remarks... Waterman , Jacobs Street.
I saw the ScotlandsPeople baptisms mentioned here for a Thomas baptized in 1743 at Falkirk to Alexander Dalrymple / Susanna Precy, in 1744 at Falkirk to John Dalrymple / Isabell Marshal, and in 1746 at Canongate, Edinburgh, to James Dalrymple / Jean Heatherton. There is also a record from ScotlandsPeople for a Thomas Dalrymple born on 29 April 1742 / baptized on 6 May 1742 at Ayr to Anna Dalrymple, with the space for the father left blank.
I couldn't link Thomas to any parent with any confidence just yet.
Bill