Pamela Anderson's throwing a Hail Mary to Kanye West to help her friend, Julian Assange -- who she claims is being tortured.

The former "Baywatch" star penned a letter, which TMZ obtained, to the rapper asking what he thinks about the WikiLeaks founder, saying ... "I support him and I know you value Free Speech." She says Assange -- who's claimed political asylum at London's Ecuadorian Embassy -- is in grave danger "for exposing corruption in governments" and thinks people are trying to kill him.

She also says he's been cut off from phone calls, internet and all visitors -- including her, but she has a plan that could set him free.

Pam believes Assange just needs more people to see his side of things and understand his genius ... and Kanye could be the guy to drum up public support.

She writes to Ye -- "I've always supported your 'no filter' - you speak your mind. And you make an impact. I'm sure a lot of people feel like you - They just are stuck in what society says is OK to say."

Pam's encouraging Kanye to research Assange because she thinks he'd admire him.

Might seem like a long shot for Kanye and Assange to link up and help each other, but then again ... stranger things have happened.