Right now, there is no way to do this from scoutscript, but you can do it using a custom sketch by calling Arduino's
One word of warning, though: If you use the pin as a digital input and apply 3.3V to it, that is too much for the ADC. This works fine while doing digitalReads, but as soon as something triggers an analogRead, that 3.3V is connected to the ADC and it might break the ADC. I think the normal Bootstrap code will do this analogRead periodically when the pin is configured as an input.
I've been meaning to improve this and add support for selecting between digital and analog input modes at the scoutscript level, to ensure that this never causes any problems. Hopefully this will be available in a new Bootstrap release in the next few weeks.