Trying to suppress posts with a specific named tag in the main loop

My theme shows most post lists as a multi-column set of “cards” which then link to the full post. I use a template part to display the cards (and format each one differently based on their post-format (aside, image, standard)). I was using tag=“featured” to select posts for the home page, and this was working well, but then I realised that it would be simpler to administer if I used sticky posts for anything I especially wanted up front. However, I have a special set of posts that I randomly show in the sidebar - these have the tag “random” - and I’d prefer not to show these among the other posts on the home page.

My problem is that the tag id will be different on each site the theme is used, depending on the order tags get created, so I can’t use tag id with “not in” in the loop specs. There isn’t a tag slug option for “not in” so I can’t use that. And when I test for the tag in php code I can’t find a way to combine the “include template part”, “IFhas_tag”, and “the loop” so the tag test stops all the html for that post from being created - and I get a hole in the output where the random post would have been, or in one test, the clearfix set was missing, so I got a different kind of “hole”…

I’ll probably be changing this, but for now the result can be seen at Here’s a screen shot of the relevant code in Pinegrow as it stands today (this may not be exactly the code used on the live site, as I’m testing locally):

Any thoughts as to what else I can try?