Kittens are very curious and they always want to know what is going on so they will find any way to find out and the best way is usually climbing up your leg. Here are some ways to prevent this.
Cats weirdly like to be by your face. They feel far away when they are way down on the ground and we are so high up. So when you see you cat about to jump on your leg bend down and hold your hands out. Let your cat jump on your chest.
This will teach your cat not to jump on your legs and to only jump when your hands are out and open.
When the kitten gets older and can jump higher he or she will be able to jump directly to your chest with you having to bend down. Just make sure your cat knows that they can only jump when your hands are out.
Just discipline your cat if they jump when not allowed.
Sometimes I would just pick up my kitten and let her rest on my shoulder and she was perfectly fine because she could see what was going on. I made a whole meal once with her just sitting on my shoulder.