They clung onto the hull before being swept away from the dinghy by the choppy waves.
Belfast Coastguard asked a Royal Navy minesweeper on patrol near Ailsa Craig, which lies about 10 miles off the Scottish coast, to rescue the men there this afternoon.
The men let off a distress flare to guide HMS Blyth to them. Girvan all-weather lifeboat, Girvan Coastguard Rescue Team, and the Royal Navy helicopter from Prestwick also attended the incident.
Liam Colquhoun, Watch Manager at Belfast Coastguard, said:
The minesweeper rescued the two casualties within 20 minutes of the initial call being made.
They were cold and wet and were checked over by the minesweeper’s medical team. They weren’t injured.
Fortunately, they were wearing lifejackets and carrying flares.
The two men are being taken back to Girvan in the all-weather lifeboat.