fears for his life due to a woman who he claims has been making his life a living hell for 2 years now.

The rapper beelined it to court requesting a temporary restraining order against an L.A. woman named Micaela Jimenez, who A$AP claims has shown up uninvited to his crib numerous times … even making it into his master bedroom once.

In docs, obtained by TMZ, the rapper says Jimenez “has been relentless in her fixation with me and my whereabouts” to the point she’s contacted family members and close friends trying to coax info out of them. Rocky alleges, just last month, she arrived at his house, demanded to see him and threatened to force her way inside.

His security told her to leave, and she eventually did, but not before tossing ink all over his parked car and yelling, “F*** you, I’ll be back again!” … according to the docs.

A$AP claims there were other incidents … like when he claims he found Jimenez sleeping in her car in close proximity to his house. Then in April, he claims Jimenez showed up saying she’s married to the rapper.

There’s another alleged incident in December 2018 … when Rocky was performing at Midnight Rave. A$AP says when he entered the mosh pit, she hugged him from behind. He claims there’s video footage of the incident.

That same night, Rocky claims that as he entered his crib to leave the venue she “jumped in without my permission landing on my lap while I was in the backseat. I was startled, shocked and fear for my safety.”

But, the freakiest incident allegedly went down in June 2018 … when Jimenez allegedly showed up to the crib, punched Rocky’s assistant and raced upstairs to his master bedroom. Rocky claims “I was startled, jumped up and began to resist [her] advances.” He claims she also ripped a pearl necklace off his neck.

According to the docs, the rapper’s personal security ultimately arrived and removed her … and Rocky says his assistant filed a police report.

For now, however, the judge has denied Rocky’s request for a restraining order until a hearing next month … saying it’s not illegal for Jimenez to sleep in her car and no