What I'll describe next comes from the paper

*Ordinary differential equations on vector bundles and chronological calculus (R. V. Gamrelidze, A. A. Agrachev and S. A. Vakhrameev).*

In the following $M$ must be second countable (it doesn't have to be compact). For a point $p\in M$ consider the map $\mathsf{ev}_p: C^\infty(M)\longrightarrow \mathbb R$ given by:

$$\mathsf{ev}_p(f):=f(p).$$

It is clearly an $\mathbb R$-algebra morphism.

**Theorem 1.** There exists a bijection:

$$M\longrightarrow \mathsf{Hom}_{\mathsf{Rng}}(C^\infty(M), \mathbb
R)-\{0\},$$

which is given by:

$$p\longmapsto \mathsf{ev}_p.$$

The proof can be found in the forementioned paper. However, using this we can characterize easily the smooth functions on $M$.

**Theorem 2.** There exists a bijection:

$$C^\infty(M, N)\longrightarrow
\mathsf{Hom}_{\mathsf{Alg}}(C^\infty(N), C^\infty(M))$$

which is given by:

$$f\longmapsto (f^*: C^\infty(N)\longrightarrow C^\infty(M),
g\longmapsto g\circ f),$$
which preserves composition.

It is easy to see this map is well defined (that is, $f^*$ is a homomorphism of $\mathbb R$-algebras). On the other hand, given $g\in \mathsf{Hom}_{\mathsf{Alg}}(C^\infty(N), C^\infty(M))$ define:

$$f(p):=q\quad (p\in M),$$
where $q\in N$ is the unique point such that:

$$\mathsf{ev}_p\circ g=\mathsf{ev}_q.$$

Such point $q$ exists by Theorem 1. applied to the nonzero ring homomorphism $$\mathsf{ev}_p\circ g:C^\infty(M)\longrightarrow \mathbb R.$$

The smoothness of $f$ follows from the following criterium:

$$f\in C^\infty(M, N)\Leftrightarrow h\circ f\in C^\infty(M)\ \forall h\in C^\infty(N).$$
In fact:
$$f^*(h)(p)=h(f(p))=h(q)=\mathsf{ev}_q(h)=\mathsf{ev}_p\circ g(h)=g(h)(p),$$ for every $h\in C^\infty(N)$ and for every $p\in M$, that is $$f\circ h=g(h)\in C^\infty(M)\ \forall h\in C^\infty(N),$$ and we are done. The above computation also shows that $f^*=g$.

Now using the above you can show easily $f$ is a diffeomorphism if and only if $f^*$ is an isomorphism of algebras.

I believe the above constructions gives an equivalence (maybe an isomorphism) of categories between the category of second countable manifolds $\mathsf{Man}$ and the category $\mathsf{Alg}_{\mathbb R}$ of $\mathbb R$-algebras. Just check how the categories $\mathsf{Man}$ and $\mathsf{Alg}_{\mathbb R}$ are defined in order to this equivalence to hold.