If I read the information posted correctly it looks like
“James Sparks, Gardener, St Andrews, (maybe) Kirkheugh"?
However that’s where he was residing at the time of the marriage.
Assuming he was born say between 1757 & 1770, there were 8 James Spark, 0 in Fife
& 2 James Sparks, the one posted and the other in Greenock.
JAMES SPARK/MARGARET IRELAND, 5 Spark/Sparks children baptised various places in Fife
As the eldest son was ROBERT 2/11/1788 Largo, it is a fair assumption that his father was Robert.
Colin