We consider a spherically symmetric homogeneous perfect fluid undergoing a gravitational collapse to singularity in the framework of higher-dimensional Rastall gravity in the cases of vanishing and nonvanishing cosmological constants. The possible final states of the collapse in any finite dimension are black hole and naked singularity, but the naked singularity formation becomes less favored when the dimension is increased. We find that there are two physically distinct solutions for the collapse evolution in the case of nonzero cosmological constant: trigonometric and exponential solutions. The effective energy density of the fluid is decreasing (increasing) in the former (latter) when the magnitude of the cosmological constant is increased, which implies that the former undergoes a slower collapse than the latter. Furthermore, we find that a temporary trapped surface is possible to emerge in the case of trigonometric solution in the naked singularity region only. Therefore, distant observers with observational time shorter than the collapse duration may conclude that a black hole is formed, although the collapse will eventually lead to a naked singularity formation.