> What is wrong with this approach?

TL;DR You are correct that the force needed to maintain constant velocity of the cart is

$$F = \frac{dp}{dt} = \frac{d}{dt} m v = m \frac{dv}{dt} + v \frac{dm}{dt} = v \frac{dm}{dt} \qquad \text{where} \qquad \frac{dv}{dt} = 0 \tag 1$$

which follows directly from the *second Newton's law of motion*. However, be **extra careful** with how you apply the procedure from the Eq. (1). It works only in a *reference frame* in which sand has horizontal momentum equal to zero, which is the case in your example. Otherwise, the only way to solve this problem would be via momentum. Check the ["Variable-mass system"][1] Wiki article for more details.

The key to understanding the *"contradiction"* you mention is that kinetic energy is lost to the **perfect inelastic collision**. I show below how to calculate the lost kinetic energy in two ways: (i) via *conservation of energy*, and (ii) via *conservation of momentum*. This explains why the force you got from the *conservation of energy* is half the force from Eq. (1).

----------

### Lost kinetic energy via *conservation of energy*

The work $dW$ done by the force $F$ over displacement $dx$ is

$$dW = F \cdot dx = v \frac{dm}{dt} dx = v \frac{dx}{dt} dm = v^2 \cdot dm$$

Integrating the above equation we get that the total work done by the force $F$ to give sand of mass $M$ required velocity $v$ is

$$W = M v^2$$

It does not matter whether the particle gained mass or velocity, the kinetic energy is always $K = \frac{1}{2} m v^2$. The change in kinetic energy in your example is

$$\Delta K = \frac{1}{2} (m + M) v^2 - \frac{1}{2} m v^2 = \frac{1}{2} M v^2$$

where $m$ is mass of the empty cart. From the *work-energy theorem* and *law of conservation of energy*, kinetic energy lost to the *perfect inelastic collision* is

$$\boxed{K_\text{lost} = W - \Delta K = \frac{1}{2} M v^2}$$

----------

### Lost kinetic energy via *conservation of momentum*

Conservation of momentum for *perfect inelastic collision* is

$$(m \cdot v) + (dm \cdot 0) = (m + dm) v'$$

where $m$ is mass of the cart plus sand added up until some point in time, $v$ is the cart velocity maintained at constant value by applying force from Eq. (1), $dm$ is additional *infinitesimally small* mass of sand we put into the cart, and $v'$ is new velocity due to the perfect inelastic collision

$$v' = \frac{m}{m + dm} v$$

The *infinitesimally small* loss of kinetic energy due to the *infinitesimally small* added mass of sand $dm$ is

$$dK = \frac{1}{2} m v^2 - \frac{1}{2} (m + dm) v'^2 = \frac{1}{2} m v^2 \frac{dm}{m + dm}$$

By rearranging the above equation we get

$$m \cdot dK + \underbrace{dm \cdot dK}_{\approx 0} = \frac{1}{2} m v^2 \cdot dm$$

We can neglect the product of two infinitesimally small values ($dm \cdot dK \approx 0$) which gives

$$dK = \frac{1}{2} v^2 \cdot dm$$

By integrating the above equation we finally get that the total kinetic energy lost in the perfect inelastic collision is

$$\boxed{K_\text{lost} = \frac{1}{2} M v^2}$$

where $M$ is total mass of sand in the cart.


  [1]: https://en.wikipedia.org/wiki/Variable-mass_system