There is a command that simply moves the camera forward, add in a speed that is controlled with the spacebar, and your set. You will have to keep a record of the space key for 2 cycles, so the player has to release it before pressing again.
sync on
sync rate 60
`make a load of objects, as if the Z axis is a road
for o=100 to 200
make object cube o,100
`random X, but leaving a 200 unit gap down the middle
x=rnd(100)+100
if rnd(1)=1 then x=0-x
position object o,x,50,(o-100)*100
next o
`make finish line
make object cube 99,200 : position object 99,0,20,10000 : scale object 99,100,1,1
do
`Reset the camera to start of race
position camera 0,25,0
rotate camera 0,0,0
`game timer reset
t=-1
`speed to 0
spd#=0
`loop while camera is behind finish line
while camera position z()<10000
`store last and current spacekey
last_spc=spc
spc=spacekey()
`set the game timer on first spacekey
if spc=1 and t=-1 then t=timer()
if spc=1 and last_spc=0 then inc spd#,1.0 else dec spd#,0.1
if spd#<0.0 then spd#=0.0
move camera spd#
text 0,0,str$(int(spd#*10))
sync
endwhile
tim#=(timer()-t)/1000.0
while returnkey()=0
text 0,0,"Time (sec) = "+str$(tim#)
text 0,20,"Press return to restart"
sync
endwhile
loop

Health, Ammo, and bacon and eggs!
