Scott Tribe (27) of Strathmore Street, appeared at Dunfermline Sheriff Court.
He admitted that between May 5 and June 2 last year he was concerned in the supply of cocaine.
Depute fiscal Sarah Lumsden told the court that police and executed search warrant on June 2 last year when Tribe was in the house.
Police found 29 grams of cocaine with a street value of up to £1240.
Sheriff Charles MacNair called for reports and allowed bail to continue until sentencing on October 16.
He warned Tribe: “This was the supply of a Class A drug over a significant period and your second conviction for drug dealing on indictment.
“It seems to me that unless something very remarkable comes up it would be difficult to see that a non-custodial sentence would be appropriate.”