Planets have been revealed both in binary and triple stellar systems. Although there have been several studies of the late stages of planet formation in binary stars this process does not appear to have been studied in triple stellar systems. To understand how the late stage of planetary accretion is affected by a third companion, in this work we have numerically investigated the formation of planets in a hypothetical triple stellar system. The system is composed by an inner binary formed by two half-solar-mass components orbited by a solar-mass star. In our experiments, lunar and Mars-sized planetary embryos are distributed around the centre of mass of the inner binary system. Our main goal is to analyse how the formation of planets evolves depending on the orbital configuration of the massive distant companion. We have performed an extensive number of numerical simulations considering different orbital configurations for the third star. All simulations were numerically integrated for at least 107 years. The results show that when the protoplanetary disc and the stars are initially on coplanar orbits, one or two planets are quickly formed between 6 and 8 AU. In general such planets have also small eccentricities with values about 10−2. On the other hand, when the third star is considered initially on inclined orbits (even tiny values), there tends to occur a significant increase in the inclination of bodies of protoplanetary disc, which prevents the collisions between these objects and their growth. As a result, in this latter case we do not evidence the formation of planets during the timescale of our integrations but note the existence of several leftover objects that can survive for longer than 10 Myr, moving in orbits with semi-major axes ranging between ~6 and 8 AU. Thus, our results do not rule out the planet formation in this kind of stellar arrangements at all, but they indicate that, if planetary bodies keep stable orbits, the late stage of planet formation in systems with a highly inclined third star can be a very long process and many of these triple hierarchical systems might not have had time to form planets and planetary systems. They could be harbouring only debris discs, fragments or planetesimals.