I want to build an airplane but I have limited power(25-28hp). This means that I have to build a power efficient airplane and I finalised on building a tandem airplane. I've read that the wing spacing(distance between the trailing edge of front wing and leading edge of aft wing) should be about 30-50% of the wing span. So my question is, what wing spacing is best? I suppose that will help me estimate the length of the aircraft from prop spinner to rudder as intend using wing tip rudders
A tandem wing is never the most efficient planform, but makes for a compact airplane. A case in point is the French design Pou du ciel ("sky louse") which was a very popular homebuilt in the 1930s. The closely coupled wings and the short wing span made it one of the smallest man-carrying designs, but since the rear wing could act like a slotted flap, producing nonlinear lift increases, the aircraft needed careful handling.
Pitch control was achieved by changing the incidence of the forward wing, and a trailing edge down movement normally created a pitch-up moment. Once the gap between the forward wing's trailing edge and the rear wing became too small, the rear wing would show a nonlinear lift increase and add a nose-down movement which became stronger when the pilot pulled the stick further aft. In this condition the aircraft would dive into the ground unless the pilot counter-intuitively moved the stick forward again.
Mignet HM 14 Pou du Ciel (picture source). The initial type flew with a motorcycle engine of 17 HP.
Your idea of moving the wings apart is sound. However, in order to make the plane statically stable, the rear wing needs to produce less lift per area relative to the forward wing, making it less efficient. If you now run an optimizer which varies wing area and minimizes overall drag, you will invariably end up with a conventional design in which the rear wing has 15% - 20% of the area of the main wing.
What is the optimum distance between the wings? This depends entirely on your preferences. You need to know that stability increases linearly with wing-tail distance while pitch damping increases with the square of it. If you want an agile aircraft, keep both close together. If you want to reduce the tail surface and don't intend to fly aerobatics, move both apart. The key figure for stability is the tail volume, which is the product of tail surface area and the distance between wing and tail. Look at airplanes you think are worth emulating and try to match the tail volume of your design to theirs. But don't use a magic number.
In order to minimize engine power, reduce speed. The power need of an aircraft scales with the third power of speed, and many designs of the 1920s successfully used motorcycle engines. A high aspect ratio and a low wing loading, like in a glider, will help to get airborne with just 25 HP. Successful designs with such small engines were the Daimler L 20 or the Messerschmitt M 17.
Messerschmitt M 17 (picture source)