Ms Forbes, a member of the Free Church of Scotland, said John Swinney was saying a woman with "Christian views" was not suitable to be first minister.
Mr Swinney said he profoundly disagreed with Ms Forbes, despite his own "deep religious faith".
The leadership candidate said she would have voted against equal marriage laws.
But Mr Swinney, who has been standing in as Scotland's finance secretary while Ms Forbes was on maternity leave, said her views were nothing to do with religion.
Responding to his remarks, a spokesman for Ms Forbes said: "The prime minister is a Hindu, the mayor of London is a Muslim.
"So many will wonder why the deputy first minister believes a woman holding Christian views should be disqualified from holding high office in Scotland."
Mr Swinney stopped short of calling for Ms Forbes to quit the race to succeed Nicola Sturgeon.
A campaign source told the BBC that Ms Forbes intended to "fight on".
Several key backers withdrew their support after she made clear would not have voted for gay marriage if she had been an MSP in 2014.
Scottish Greens MSP Ross Greer, a member of the Church of Scotland, also told BBC Scotland that his party would not support a first minister who could not "unequivocally back LGBTQ rights".
He told BBC Radio Scotland's Drivetime programme: "The objections to Kate's comments are not because she believes in God, it is because she said she would have voted against equal marriage.
"I think it is fine if you hold a personal faith, where it becomes relevant in politics is if your faith is influencing how you vote."
He added: "The Greens have been very clear, what we want from any candidate for first minister is an absolute commitment to LGBTQ equality."
Ms Forbes has said that people should not be excluded from political office because they are a member of a particular faith.
Ms Forbes took time out of the spotlight on Wednesday following controversy over a series of interviews earlier this week.
It is understood she has brought in a media adviser as part of her effort to reshape her campaign.
The Free Church of Scotland has said it was composed of people "from all political persuasions, some of whom will not share Kate's politics, particularly over an independent Scotland".
It said it was concerned at the level of "anti-Christian intolerance which has been displayed on social media, and by some political and media commentators".
A spokesperson said: "It is lamentable that Kate's honest adherence to simple traditional values would, for some, disqualify her from contributing to the public good of Scotland."
Ms Forbes' rivals to replace Ms Sturgeon are Health Secretary Humza Yousaf and the former community safety minister, Ash Regan, who has announced plans to formally launch her campaign on Friday.
Both Mr Yousaf and Ms Regan have said they back gay marriage - although Mr Yousaf was absent when the final vote on legalising it was held in 2014 despite supporting it at an earlier stage.
Ms Regan has called for an end to "mudslinging" in the contest, adding: "We've all got to remember that we're all going to be working together at the end of this."
Nicola Sturgeon has not endorsed any of the three candidates, but said the views of the next first minister mattered because people want someone to will stand up for their rights.
She denied that the party is tearing itself apart in the contest to replace her and said the majority of people in Scotland wanted it to be a socially progressive country.
Nominations for the SNP leadership race close on Friday and the winner will be announced on Monday 27 March.