"Westminster's in-out referendum on the EU is a 20 billion pounds [some $30 billion] gamble with the future of Scottish and British farming," Lochhead said in a statement.
According to the minister, leaving the bloc would mean Britain abandoning the Common Agricultural Policy (CAP) that serves as a "protective shield" for the country's agriculture.
"It would be folly to think the UK Government would fund farming at anywhere near existing levels from domestic budgets and so the EU referendum is the biggest risk to agriculture in this country," Lochhead added.
The UK is due to receive $29.8 billion in direct payments via the CAP covering the period from 2014 to 2020.
UK Prime Minister David Cameron has claimed he will hold a referendum on the UK membership in the EU in 2017 if the Conservative Party wins the May national election.