Though if you’re looking for a script to run when the Pico receives power simply create a new Micropython script with the name ‘main.py’ and save it on the Pico (you can load it on there in Thonny).
I see @Liam 's reply would work for the Raspberry Pi Pico, but did you have the raw RP2040 IC? If so they don’t have any onboard flash storage so you’ll have to make sure that any designs you make include some, RPi’s docs cover this pretty well!
Then you can use the instructions Liam linked above.