John Mein, 57, pleaded guilty to being concerned in the supply of amphetamine at his Scott Street home in June 2019.
The court was told that drugs to the maximum value of £4,740 were recovered from the property.
Procurator fiscal Fraser Matheson said that acting on intelligence received, police obtained a search warrant for Mein's home in June 2019.
He said: “Police entered the property and Mr Mein was within. He was detained as a search of the property was carried out. A quantity of white substance was found and after being analysed it was found to be the drug amphetamine."
Mr Matheson said officers were satisfied they recovered evidence of drug dealing taking place at the property.
Defence lawyer Stephanie Clinkscale argued there was an alternative to a custodial sentence.
She said that it had been a condition of Mein's bail that he had to allow a police officer entry into his property even without a warrant.
Ms Clinkscale added: “He was visited by the police on seven occasions to see if he would comply with that condition. Nothing untoward was found in the property."
He was also due to be sentenced for breaching a non-harassment order which he had previously pleaded guilty to.
The court was told that unemployed Mein received more than £1,000 a month in Universal Credits and disability benefits.
Sheriff Peter Paterson imposed 250 hours unpaid work, to be carried out over the next 18 months, as a direct alternative to custody.
Mein was also fined £200, with a £10 victim surcharge, for breaching the non-harassment order.