How do I give a player a score if they have an item in their inventory?

This should do it:

execute as @a store result score @s tagged run clear @s name_tag{display:{Name:"\"Tagged\""}} 0

I don't use the store function in execute very often and I haven't tested it, but this should do it.