The occupants of the property in Dalswinton Avenue were awoken just before 3 am today by the smoke detector in their home going off.
They then spotted the blaze outside the window and called the fire and rescue service.
Firefighters attended and extinguished a mattress which had been set alight against the wall to the building.
Slight damage was caused to a window and smoke had entered the flat.
Police are investigating the fireraising and Constable Susan Kerr at Dumfries said: “This was a completely reckless and dangerous act which could have had very serious consequences. It appears that this mattress, which may have been dumped near to the flats for sometime has been set on fire.
“We are appealing for anyone with any information about this incident to get in touch with us at Dumfries on the 101 number.”