It is possible to control the Apple Scanner lamp through the control flags in the scanner driver. However, in normal operation, this function is controlled exclusively by the AppleScan software, and any changes would require either a modification to the AppleScan software (not a solution supported by Apple) or writing a custom scanner application.
As an alternative, it is also possible to remove the lamp from the Apple Scanner and still be functional with the AppleScan software.