The Scottish Sun reports Mr Mackay befriended the teenager on Facebook and Instagram and sent him 270 social media messages.
The allegations emerged as Mr Mackay, 42, prepares to unveil the Scottish Government's Budget for the next financial year on Thursday.
Nicola Sturgeon has since confirmed Mr Macky has resinged from his post and that Kate Forbes MSP will make the Budget announcement later today.
"He has submitted his resignation as a government minister which I have accepted.
"Derek has made a significant contribution to government, however he recognises that his behaviour has failed to meet the standards required.
"The Minister for Public Finance, Kate Forbes, will present today’s Scottish Government budget setting out our actions to support the economy, back our people and public services and tackle the climate crisis, and that remains my government's focus.”