Can I use a switch to toggle the neutral bonding on a generator?
You have two choices.

1) Remove the jumper on the generator, and connect it to the transfer switch as you had planned. But have to put the jumper back on if you ever want to use the generator separately. You also have to hard wire the neutral through the transfer switch.

or

2) You can leave the jumper on the generator, drive a separate ground rod for the generator or connect it to a newarby ground rod with a suitably sized grounding electrode conductor, and change the transfer switch to a 3 pole that switches both phase conductors and the neutral.

Short version is, if you switch the neutral you need a ground rod and a system bonding jumper and if you hard-wire the neutral you need to remove the system jumper on the generator. I agree with Ed Beal putting a switch on the jumper would make it too easy to leave in one position or the other. But then if you leave the jumper on for separate use you may forget to take it off for the transfer switch if you go that way.

Your best course might be to leave it on and use method 2 with a 3 pole transfer switch.

Refer to Article 250.30 for the proper grounding of separately derived systems.

Happy Tuesday!