Shane Merchant tried to hide a package in his trousers when officers stormed the property on Sycamore Green in June 2019.
He was finally sentenced at Leeds Crown Court this week.
Prosecutor Laura Marshall said two women were found at the kitchen table among drugs and paraphernalia.
Merchant was then seen trying to put a bag in the waistband of his trousers, but they fell to the floor.
They found heroin around the property worth more than £1,300, crack worth £220 and cocaine worth £40.
they also found scales and mobile phones belonging to Merchant containing drug-dealing messages.
Michael Greenhalgh, mitigating, said 49-year-old Merchant was now homeless but had sought to address his own drug addictions.
He admitted supplying heroin and crack cocaine.
He has 21 convictions for 52 offences, but had stayed out of trouble since the raid.
The judge, Recorder Benjamin Nolan QC told him: "It was three years ago, you have not been involved in any offences since then, and you appear to have made a degree of progress.
He jailed him for two years, but suspended the sentence for two years, and ordered him to undergo six months of drug rehabilitation.
One of the women arrested at the scene, 57-year-old Collette Allanson, of Sycamore Green, also appeared alongside Marchant at Leeds Crown Court, where she admitted possession of Class A drugs. She was given a two-year conditional discharge.