A Green function and regularity results for an ultraparabolic equation with a singular potential