Petey Pablo -- the platinum rapper who allegedly tried to smuggle a gun into an airport on 9/11 -- claims there's actually a heroic reason why the pistol turned up in his luggage.
As we previously reported, Pablo -- real name Moses Barrett III -- was arrested on Saturday at RDU Airport in North Carolina after a TSA officer found a Smith & Wesson pistol in his carry-on.
But Petey's rep tells us the rapper can explain -- claiming the gun actually belongs to one of his friends. And last month, Petey learned that said friend planned to use the pistol to "do something crazy" ... so Petey stepped in and literally took the weapon away.
The rep tells us Petey stashed the gun in a luggage bag so his friend wouldn't find it -- and when he was asked to hop on a last-minute flight to L.A., he grabbed the loaded bag without thinking.
Petey was arrested on suspicion of carrying a concealed weapon, possession of a firearm by a felon and possession of a stolen firearm. He's due back in Wake County Court October 4.