A little more in case it helps:
According to young David Barrie's death certificate (see Andrew's database) David died at "Bothwell Academy Crescent Bothwell". This would therefore seem to indicate both the name of the school and its address. However, I cannot find this address or street in modern directories, which might indicate that either or both no longer exist.
A search of the 1871 Census for Scotland for Alexander Barrie proved of no help, either, because by then (just a year after Jamie had left the school) Alexander's occupation was "H. M. Inspector of Schools" and he was living with his parents (and some siblings) at 21 Canmore Street, Forfar. It would seem therefore that Alexander had left the school he founded, perhaps closed it down even, in about 1870, and at the ripe old age of about 28.
In conclusion, I would suggest that Jamie might have been an occasional visitor to the school between, say, 1865 and 1868 , and he boarded there between 1868 and 1870. This predates the date you give for your converted schoolhouse, of course.