If you sprint attack an entity and hold down your sprint key (for me, it's SHIFT), you will continue to sprint, but the scoreboard will not increase. It's only when you resprint that it will start increasing again.
duplicates
MC-11608Sprinting is cancelled when attacking a mob
Resolved
relates to
MC-69459Client-server desync when player attacks while holding sprint key