I am looking for a (Hilbert) space of (real-valued) functions on $\mathbb{R}^n$ where the following map defines an inner product: $$ (f,g) \mapsto \lim_{T\to\infty} \frac{1}{\mathrm{Vol}[-T,T]^n}\int_{[-T, T]^n}f(x)\overline{g(x)} dx. $$ This looks similar to the space of almost periodic functions. However, I want my space to contain all of the indicator functions of periodic sets (which Bersicovitch space does not).
The best I can come up with is to just take the set of all functions $f$ for which the mean of squares $$ \lim_{T\to\infty} \frac{1}{\mathrm{Vol}[-T,T]^n}\int_{[-T, T]^n}|f(x)|^2 dx $$ is well-defined and finite. To make it into a Hilbert space, I just take the quotient by everything that has mean-value zero. Is this a well-known space? I did not find anything in the literature.
As per daw's comment, the answer is to use Besicovitch space, described here. This space contains all periodic functions, which can be seen for example by using a Fourier series.
A thing that I overlooked is that the space of all functions for which the mean value of squares $$ \lim_{T\to\infty}\frac{1}{\mathrm{Vol}[-T,T]^n}\int_{[-T,T]^n}|f(x)|^2dx $$ is finite, is not a vector space. If it were, then $(f_1 + f_2)^2$ should have a finite mean value for all $f_1$, $f_2$ in the space, which implies that $f_1f_2$ should have finite mean value. A counter example of this is as follows. Let $f_1 = 1$, the constant $1$ function, and $S$ a set such that its indicator function $\chi_S$ is not in the space. Then define $h(x) = 1$ for a $x \in S$ and $h(x) = -1$ otherwise. Clearly, $h$ is in the space, since $h^2 = 1$, but the mean value of $1 h = h$ is not well-defined.
Beside Besicovitch space, there are other, much larger, spaces, that contains all functions for which $$ \limsup_{T\to \infty}\frac{1}{\mathrm{Vol}[-T,T]^n}\left(\int_{[-T,T]^n}|f(x)|^pdx\right)^{1/p} $$ is finite, for fixed $1 \leq p < \infty$. This then defines a seminorm. These spaces are known as Marcinkiewicz spaces.