You don’t.

I’ve worked for many companies and taken some trainings I thought were poor quality.  But you don’t professionally “opt out” of any mandatory corp training, whether it’s cybersecurity, ethics, technical, safety, diversity, or how to run the fryolator. 

By having such a training, the organization is saying “this is what we expect and we don’t intend you to have an excuse of ‘well but I didn’t know’ if you do things differently.”

If you talk about opting out beyond “Is this optional?  No?  OK.” it means that you disagree with the goals and are rejecting the approach of the organization. That means you are a poor fit for the organization and will start to be labeled as such in promotion and retention discussions.

You can give feedback on the approach and probably rate the specific training, though depending on how strident you intend to be anonymous feedback will be better.

Organizations don’t like liability.  Your library leadership has fear of being in the news for some low level worker calling the cops on a library patron for “being Black in a public space” or otherwise alienating their community, an occurrence that is sadly common.  They want to make sure every opinionated weirdo on their staff has clearly heard their expectations so that when it happens they can say “look we trained them this isn’t on us.” You are basically talking about saying to them “I want you to take on more liability because I am easily bored and/or put my personal politics above such things” and there is no up side for them in that.  

They may or may not say “do it or you’re fired,” but giving a no-upside event to your employer means they will treat you accordingly.