  The discovery of millisecond pulsars switching between states powered either
by the rotation of their magnetic field or by the accretion of matter, has
recently proved the tight link shared by millisecond radio pulsars and neutron
stars in low-mass X-ray binaries. Transitional millisecond pulsars also show an
enigmatic intermediate state in which the neutron star is surrounded by an
accretion disk, it emits coherent X-ray pulsations, but is sub-luminous in
X-rays with respect to accreting neutron stars, and is brighter in gamma-rays
than millisecond pulsars in the rotation-powered state. Here, we model the
X-ray and gamma-ray emission observed from PSR J1023+0038 in such a state based
on the assumption that most of the disk in-flow is propelled away by the
rapidly rotating neutron star magnetosphere, and that electrons can be
accelerated to energies of a few GeV at the turbulent disk-magnetosphere
boundary. We show that the synchrotron and self-synchrotron Compton emission
coming from such a region, together with the hard disk emission typical of low
states of accreting compact objects, is able to explain the radiation observed
in the X-ray and gamma-ray band. The average emission observed from PSR
J1023+0038 is modelled by a disk in-flow with a rate of $(1-3)\times10^{-11}
M_{\odot}/yr$, truncated at a radius ranging between 30 and 45 km, compatible
with the hypothesis of a propelling magnetosphere. We compare the results we
obtained with models that rather assume that a rotation-powered pulsar is
turned on, showing how the spin down power released in similar scenarios is
hardly able to account for the magnitude of the observed emission.
