You can confirm your suspicions by checking your baby's bottom and diaper for worms at night with a flashlight. You can also check for the presence of worms by gently pressing a piece of transparent tape to your baby's anus. Eggs will stick to the tape, and you can take it to his doctor to confirm the diagnosis.
Your doctor may also have a special kit designed to collect pinworm eggs. (You can often find the eggs even if you can't see the actual worms.)
If you don't find pinworms or eggs, anal itching may be a sign of another problem, such as dryness from cleaning the area too vigorously with soap. Red, tender skin around your baby's anus could be the result of irritation from diaper rash, diarrhea, or a bacterial infection. (If you suspect an infection, call your baby's doctor.)