You need a diode between the dynamo and battery. This will stop power from the battery making the dynamo from running like a motor. The diode shouyld be between the dynamo + positive, and battery + positive, with the stripe on the diode toward the battery + positive.
The minimum diode should be at least 50V PIV, and at least 6A. The diode may need to be bigger depending on the dynamo and expected amp output. I like at least double the expected amp rating for a diode.
G-