Yes and no.
Anything can influence someone, but you can’t force someone to do something. If I saw someone with a mullet and wanted to have a mullet myself because they inspired me to do so, that isn’t on them because they had a hairdo I thought was cool. If I cut my hair into a mullet, that’s on me. It’s this thing called free-will; people have control over their own actions. Sure, something can sway their decision, but that isn’t on you. Not as a person, not as an artist. You can’t force someone to do something they don’t want to do… as a writer. If someone ended up stalking and killing a woman, they can’t blame it on the show You. If someone became a cannibalistic serial killer, they can’t blame it on Hannibal Lecter. If someone was a bratty and spoiled rich white girl, they can’t blame it on Sharpay Evans for making them that way. You are in control over your own life, and what you do has nothing to do with some author or filmmaker or character. It’s not your problem that they can’t understand the difference between fiction and real life.
Years ago, I was writing a scene in a book where the main character was harming herself. The book was in first person. My brother, a non-reader, read over my shoulder and then read that scene and got mad. He looked at my wrists to see if there was any cuts and then he told my mom I was writing about killing myself.
Around the same time, I was also into drawing. I drew all sorts of things, but also tried to do various emotions. And both my brother and father thought I was mimicking my own emotions and were concerned, mostly because at the time, we had CPS called on us (we had just moved and weren’t in school, and one of my mom’s co-workers were nosy and saw that we weren’t going to school right away even though I was doing online schooling at the time) and thought they’d be triggered by my drawings.
Not to mention, I know of so many people who are overly religious and don’t watch or read anything fantastical because “magic is witchcraft and witchcraft is the devils’ work.” Like, I’m not worshipping Satan by watching the Hobbit you imbecile.
Plus, one of my friend’s mom’s thinks you’re worshiping Satan by doing yoga. Should that include all kinds of exercise? And my sister’s boss thinks NASA is also worshiping Satan, too, because they believe that long red line is the Devil’s tongue. 
You see what I’m saying? People make no sense these days. What you do will make them think or do anything regardless of your actual intentions, regardless of the context, regardless of anything you say or do.
YES. A fantasy can have discrimination and racism within its world. It can also provide a world where it doesn’t exist. But not every story needs to come with a world filled with either or.
Representation is key to everything. As a writer, it is your responsibility to create well-rounded characters that represent said community, to have done research to discuss controversial topics or hard subjects like mental illness and disabilities. Without good representation and effort in your research, you don’t have a great story to tell, and you’ll get hated on because of it.
But I do think that as a writer who has never experienced racism firsthand or certain discrimination, you shouldn’t have main characters that go through it because it isn’t necessarily your story to tell. This doesn’t mean you shouldn’t have a main character who is of those communities, because as a white author, you can make stories about Black or Asian characters, but don’t make their race or tragic backstories part of the premise of the story.
My own series is filled with POC characters and characters within the LGBT+ communities, but I’m not a part of them and I’m not writing a story about racism and discrimination. I’m simply writing about a group of characters going on a revenge journey. The color of their skin, gender, or sexual orientation has nothing to do with it. They’re shown as just… people.