I have some issues when I try to start my bike with my Arduino. The "start-part" works fine, but as soon as it cranks over the Arduino looses power or something and restarts.
To be clear, even if I have no GPIOs connected or anything, just 5v and GND it still restarts as soon as I start the bike.
Stick a High value elctrolytic capacitor between 5V and GND as close to the Arduino as you can.
Remove the 1K resistor, and use pinMode(P2,INPUT_PULLUP); and wire the other side to GND , the pin will read LOW when pressed! So remember to invert your 'if' statment to deal with this.
Maybe the relay is drawing too much current for the output of the Arduino.
It is better and safer to switch the relay with a transistor or an optical sensor, and don't forget a flyback diode across the relay.
This might work but you need to isolate it from the bike with a diode otherwise the bike electronics etc will discharge it. This is just a sWAG as there is no schematic for the bike. I am assuming you are using one of the relay modules that has a driver of some type on it.