Pretty simple program I decided to make in python using Forza's UDP telemetry.
This works on Forza Horizon 5, not sure about 4 because the struct may be slightly different.
If you want to try on Forza Motorsport you need DASH output.
Just execute the main.py script, then press F2 to start recording your run and F2 when you're done recording.
Typically I start in 4th gear for 6 speed transmissions, just make sure for a good dyno you have a decently long run to max RPM.