How do i test for a hit

how do i make it so that every 1/10 hit with the item: minecraft:carrot_on_a_stick[minecraft:custom_data={fire_gem:1b}] will set the entity it hit on fire in 1.21.1
Continue to help post