If the measure space $(X,\mathcal{M},\mu)$ is $\sigma$-finite, then
the proposition is true. Let me state the proposition and prove it.
Proposition: Let $(X,\mathcal{M},\mu)$ be a $\sigma$-finite measure
space. Let $p,q\in(1,\infty)$ be such that $\frac{1}{p}+\frac{1}{q}=1$.
Let $g:X\rightarrow\mathbb{R}$ be a measurable function. If for each
$f\in L^{p},$$fg\in L^{1}$, then $g\in L^{q}$.
Proof: Since the measure space is $\sigma$-finite, there exists a
sequence of measurable sets $\{A_{n}\mid n\in\mathbb{N}\}$ such that
$A_{1}\subseteq A_{2}\subseteq\ldots$, $X=\cup_{n}A_{n}$ and $\mu(A_{n})<\infty$
for each $n$. For each $n$, define $B_{n}=\{x\mid|g(x)|\leq n$}.
Define $g_{n}:X\rightarrow\mathbb{R}$ by $g_{n}=g1_{A_{n}\cap B_{n}}$.
Note that $|g_{n}|\leq n$ and $\{x\mid g_{n}(x)\neq0\}\subseteq A_{n}$
which has finite measure, so $g_{n}\in L^{q}$. Next, we observe that
$g_{n}\rightarrow g$ pointwisely. For, let $x\in X$ be arbitrary.
Choose $n_{1}$ such that $x\in A_{n_{1}}$. Since $g(x)\in\mathbb{R}$,
there exists $n_{2}$ such that $|g(x)|\leq n_{2}$. For any $n\geq\max(n_{1},n_{2})$,
we have $x\in A_{n}\cap B_{n}$. Therefore $g_{n}(x)=g(x)$ whenever
$n\geq\max(n_{1},n_{2}).$
For each $n$, define $\theta_{n}:L^{p}\rightarrow\mathbb{R}$ by
$\theta_{n}(f)=\int fg_{n}\,d\mu$. By Holder inequality, we have
\begin{eqnarray*}
& & \left|\theta_{n}(f)\right|\\
& \leq & \int|fg_{n}|\,d\mu\\
& \leq & ||f||_{p}||g_{n}||_{q}.
\end{eqnarray*}
It follows that $\theta_{n}$ is a bounded linear functional on $L^{p}$.
For each $f\in L^{p}$,
\begin{eqnarray*}
|\theta_{n}(f)| & \leq & \int|fg_{n}|\,d\mu\\
& \leq & \int|fg|\,d\mu.
\end{eqnarray*}
Therefore
$$
\sup_{n}|\theta_{n}(f)|\leq\int|fg|\,d\mu<\infty.
$$
Since the family $\{\theta_{n}\mid n\in\mathbb{N}\}$ is pointwisely
bounded, by the uniform boundedness principle, $C:=\sup_{n}||\theta_{n}||<\infty$.
Let $n\in\mathbb{N}$ and $f\in L^{p}$ be given. Define $f_{n}:X\rightarrow\mathbb{R}$
by
$$
f_{n}(x)=\begin{cases}
f(x), & \mbox{ if }f(x)g_{n}(x)\geq0\\
-f(x), & \mbox{ if }f(x)g_{n}(x)<0
\end{cases}.
$$
Clearly $|f|=|f_{n}|$, so $f_{n}\in L^{p}$. Moreover, $||f||_{p}=||f_{n}||_{p}$.
Now
\begin{eqnarray*}
& & \int|fg_{n}|\,d\mu\\
& = & \int f_{n}g_{n}\,d\mu\\
& = & |\theta_{n}(f_{n})|\\
& \le & C||f_{n}||_{p}\\
& = & C||f||_{p}.
\end{eqnarray*}
By monotone convergence theorem (or Fatou's lemma), let $n\rightarrow\infty$, then we have
$\int|fg|\,d\mu\leq C||f||_{p}$. Therefore $f\mapsto\int fg\,d\mu$
is a bounded linear functional on $L^{p}$. By Riesz representation
theorem, there exists $g'\in L^{q}$ such that $\int fg\,d\mu=\int fg'\,d\mu$.
That is, $\int f(g-g')d\mu=0$ for any $f\in L^{p}$. Let $D_{1}=\{x\mid g(x)-g'(x)>0\}$,
$D_{2}=\{x\mid g(x)-g'(x)<0\}$. We go to show that $\mu(D_{1})=\mu(D_{2})=0$.
Let $n\in\mathbb{N}$ be arbitrary. Define $f=1_{A_{n}\cap D_{1}}$,
then $f\in L^{p}$ because $\mu(A_{n}\cap D_{1})\leq\mu(A_{n})<\infty$.
Then, $\int_{A_{n}\cap D_{1}}(g-g')\,d\mu=\int f(g-g')\,d\mu=0$.
Since $g-g'>0$ on $A_{n}\cap D_{1}$, it follows that $\mu(A_{n}\cap D_{1})=0$.
(We are using the fact: If $h$ is a measurable function and $A$
is a measurable set, satisfying the condition that $h>0$ on $A$
and $\mu(A)>0$, then $\int_{A}h\,d\mu>0$. ) Now $D_{1}=\cup_{n}(A_{n}\cap D_{1})$,
being a countable union of measure-zero sets, so $\mu(D_{1})=0$.
Similarly, we can prove that $\mu(D_{2})=0$. Hence, $g=g'$ almost
everywhere and therefore $g\in L^{q}$.