Let $X$ be an $H$-space. Let $F$ be a field. Then $H_*(X;F)$ is a Hopf algebra over $F$. According to group-like elements in the Hopf algebra of the homology of H-spaces,
$$ \pi_0(X)=\{g\in H_*(X;F)\mid \Delta_* g=g\otimes g, g\neq 0\}. $$ Let $G$ denote the group generated by the monoid $\pi_0(X)$. Let $H$ be the group ring of $G$ over $F$. Let $$ L=H_*(X;F)\otimes_{\pi_0(X)}H. $$ That is, $$ L=(F\oplus H_{\geq 1}(X;F))\otimes H. $$ Question: Is $L$ the localization of the Pontrjagin ring $H_*(X;F)$ with respect to the multiplicative subset $\pi_0(X)$, i.e. $$ L=H_*(X;F)[(\pi_0(X))^{-1}]? $$
Your claim will work fine. But you need to change the thing you're tensoring over back into a subalgebra! $F[\pi_0 X]$, the sub-$F$-algebra generated by $\pi_0(X)$, is the right choice.
It might be easiest to justify by just showing that for $S$ a multiplicative subset of a commutative $F$-algebra $A$ and $G$ the free group on the monoid $S$, $A[S^{-1}]\cong A\otimes_{F[S]} F[G]$. This is easily checked via the universal property: an $F$-algebra map out of the left-hand side is an algebra map out of each of $A$ and $F[G]$ which agree when restricted to $F[S]$; thus the map out of $A$ sends $S$ to units and such a map extends uniquely to one out of $F[G]$, making the universal property equivalent to that of the localization.