A block is moving down an incline a distance of 5 m form point A to point B by a force F that is parallel to the incline and has magnitude 2 N. The magnitude of the frictional force acting on the block is 10 N. If the kinetic energy of the block increases by 35 J between A and B how much work is done on the block by gravitational force as the block moves from A to B?

Is this the equation I would use: mgh =1/2mv^2?

No, you don't use that equation. You use a conservation of energy equation that includes the frictional work done.

Work done by force F = 10 J
= (kinetic energy increase) + (potential energy increase) + (frictional heating)

In your case, the potential energy decreases. That decrease is the work done BY gravity. The frictional heating is 10 N x 5 m = 50 J