Ricky Williams is opening up about his bizarre run-in with police in Texas earlier this month ... suggesting his "fame" likely helped him stay out of handcuffs.
The ex-NFL star was stopped during a leisurely walk and searched by police on January 11 after cops were called to the area about a "suspicious person" who may have stolen a tape measure from a backyard.
Ricky was NOT arrested -- and during an interview with "The Tomorrow Show" with Keven Undergaro he suggested he got better treatment than the average black guy because of his celebrity.
"I'm a quirky person ... and it's kinda dangerous to be black and quirky unless you're famous. Then you can get away with it."
Williams -- an avid pot smoker -- says he's also glad he didn't have weed on him at the time of the incident.
Williams went on to say the experience made him understand how some interactions between citizens and police go wrong ... because of the anger he felt while he was being detained.
"If people make you feel like a criminal, it can go sour pretty quickly."