Only about 40% of farmers have received their Common Agricultural Policy (Cap) claims, leading to warnings of a "cash flow crisis" in the industry.
Rural Affairs Secretary Richard Lochhead announced the fund as he addressed the NFU Scotland annual general meeting in St Andrews.
NFU Scotland said it was "imperative" the new fund was delivered quickly.
The union had accused the Scottish government of creating a "hole" in the rural economy because of delays in allocating the EU money to farmers.
Reforms to the Cap system saw the Single Farm Payment Scheme replaced by the new Basic Payment Scheme (BPS) last year.
The BPS is the main EU subsidy available to farmers in Scotland, with the money being allocated by the Scottish government.
The payments are designed to act as a safety net for farmers and crofters by supplementing their main business income.
But payments have been affected by major issues with the IT system used to administer them, with the Scottish government also saying the challenge of implementing the reforms had been "hugely difficult".
Speaking at the AGM, Mr Lochhead said that more than 7,300 payments had now been authorised, which he said equated to about 40% of the 18,000 eligible claims.
He said he recognised that some farmers and crofters were facing hardship as a result of the delays, coupled with bad weather and difficult market conditions.
Mr Lochhead added: "We are making progress. However the extreme complexity of the policy we agreed with industry in Scotland - which is being delivered by a brand new IT system that we are constantly working to improve - means it is taking longer than expected to process applications.
"That is why the Scottish government is taking further action to ease cash flow pressures in the sector by earmarking up to £20m to ensure those most in need can access the credit they require until their payments come through.
"We will work with NFUS, banks and others to finalise the detail of the scheme and ensure it is available as quickly as possible and simple to access."
Responding to the announcement, NFU Scotland chief executive Scott Walker said: "The Scottish government has recognised the severe financial pressures that many farm businesses are under.
"But for this money to be effective it must be delivered quickly. We will be working with the Scottish government on the details of this funding but it is imperative that it is put into place swiftly."
The issue had been raised by Scottish Conservative leader Ruth Davidson in the Scottish Parliament on Thursday.
The party's MSP Alex Johnstone said: "Ministers are now having to set aside £20m of taxpayers' money to mop up their own failures to deliver this programme.
"It is a complete fiasco and rural Scotland has completely lost faith in this SNP government's ability to deliver."
Scottish Liberal Democrat rural affairs spokesman Tavish Scott said the creation of the hardship fund was an "admission of failure" by the Scottish government.
He added: "Why should farmers take out a government loan when they should be receiving the government farm payment?"
Speaking on Thursday, NFU Scotland president Allan Bowie said the majority of farmers were still "completely unaware" of when they will receive their Cap payments 20 months on from the cabinet secretary's initial statement on its implementation.
He added: "That is the hole in the Scottish rural economy that Scottish government is responsible for and the reason why the wheels have stopped turning in the Scottish countryside."
Farmers hit by delays to EU payments are to be offered loans from a £20m fund set up by the Scottish government.