The strikes over pay are due to start at 7am on Tuesday 13 January, and last until 7am on Saturday 17 January.
Talks between Gray and the BMA have been held this week.
The health secretary said: 'These discussions are ongoing and we hope to agree a resolution to avoid industrial action which is in no one's interest least of all patients. It's important to respect the confidentiality of those discussions.
'I am seeking to find compromise with our resident doctor colleagues. I respect their right to strike, I respect their right to ballot their members, of course I do.
'Industrial action will cause substantial disruption and I have ensured that our boards are prepared as they possibly can be for that industrial action should it take place next week.'
Before Christmas, more than 92% of those who voted in the BMA Scotland ballot were in favour of strike action, on a turnout of 58%.
Dr Chris Smith, chair of the BMA Scottish resident doctors committee, said members were ‘united in anger' that the Scottish Government had reneged on a pay deal agreed two years ago.
‘This is not where we wanted to be. However, we have sent a message loud and clear – the Government cannot brazenly renege on its commitments without expecting to be held to account.'
He called on the Scottish Government to present an offer that the BMA believed could be put to members.
‘We are simply asking for the Government to deliver on what they previously promised, an offer which will provide a meaningful, continued and crucially credible step on the path towards addressing the pay erosion which resident doctors have suffered from since 2008,' Dr Smith added.
