Exclusive

Kodak Black's legal team says there's something fishy about the warrant that led to his arrest on firearms charges -- they claim the reason he got busted is purely because he's black.

As we reported ... Kodak was arrested on a federal warrant at the Rolling Loud music festival in Miami back in May, with the feds claiming he falsified gun applications on 2 separate occasions to buy firearms.

Now, with Kodak still behind bars nearly 2 months later, the rapper's attorney, Bradford Cohen, tells us he reviewed a warrant from Miami-Dade Police, and he claims all signs point to cops digging into his client's records WITHOUT a search warrant.

Kodak's attorney claims the warrant states a police detective was present in the store the day KB allegedly attempted to purchase a firearm, and the detective later asked the store to review Kodak's application and interviewed a store employee.

Cohen tells us he believes the officer in the store targeted Kodak because he was black, young and wearing expensive clothing and jewelry. He says, based purely on those visuals, the cop decided to investigate his background.

Kodak's attorney also tells us he finds it highly suspicious an undercover officer just happened to be there the same day Kodak strolled into the store.

Cohen also claims Miami-Dade Police illegally snapped pictures of Kodak after he was arrested and transported to a police station, and illegally sent the pics to the media.

Kodak's attorney says these factors raise questions on how information on Kodak was obtained in the first place, and how officers conducted themselves during the case.

Our law enforcement sources tell us the state's case is still under investigation.