The gravitational potential of a gas of initially randomly distributed primordial black holes (PBH) can induce a stochastic gravitational-wave background through second-order gravitational effects. This gravitational-wave background can be abundantly generated in a cosmic era of domination of ultralight primordial black holes, with masses m PBH < 10 9 g, which evaporate before Big Bang Nucleosynthesis. Hence, the condition to avoid overproduction of gravitational waves at PBH evaporation time, can act as a novel method to extract constraints on cosmological models and gravitational theories. We consider f (R) gravity as the underlying gravitational theory and we study its effect at the level of the gravitational potential of Poisson distributed primordial black holes. After the general analysis we focus on Starobinsky R 2 gravity model and we extract strong constraints on the involved mass parameter, denoted as M , as a function of the initial primordial black hole abundance, Ω PBH,f and the black hole mass, m PBH . In particular, one finds that in general 5 × 10 −14 M min M Pl 10 −5 , and only in the extreme possible regime where Ω PBH,f > 10 −3 we get that 10 −5 M min M Pl 10 −1 .