Extension of measurable function from dense subset Let $M$ be a compact riemannian manifold equipped with a geodesic distance  and let $\mathcal{B}(M)$ be the borel sigma algebra generated by the geodesic distance. Let $(\Omega,\mathcal{F},\mathbb{P})$ be a probability space that arises from a compact metric space $(\Omega,d)$ and $\mathcal{F}$ is the borel sigma algebra. Let $\tilde{\Omega}$ be a countable dense subset of $\Omega$.
We would like to answer to the following question:
Let:
$$f \colon (\tilde{\Omega},\mathcal{F}_{\rvert\tilde{\Omega}}) \to (M,\mathcal{B}(M))$$
be a measurable function.
Is it possible to construct a function
$$g \colon  (\Omega,\mathcal{F}) \to (M,\mathcal{B}(M)) $$
with the property that $g$ is measurable, $g_{\rvert\tilde{\Omega}}= f$ and,
if $\omega \in \Omega\setminus \tilde{\Omega}$, then
$$g(\omega)= \lim_{n \to \infty}f(\omega_n) $$
for a sequence  $ \{\omega_n\}_{n \in \mathbb{N}} \subset \tilde{\Omega}$ such that $\omega_n \to \omega$ as $n \to \infty$?
 A: $\newcommand\R{\mathbb R}\newcommand\om\omega\newcommand\Om\Omega\newcommand\tom{{\tilde\omega}}\newcommand\tOm{\tilde\Omega}\newcommand{\ep}{\varepsilon}\newcommand{\de}{\delta}\newcommand{\vpi}{\varphi}\newcommand\ol\overline\newcommand{\N}{\mathbb N}\newcommand{\Q}{\mathbb Q}$Take any $m\in\text{Im}(f)$ and then let
$$g(\om):=
\begin{cases}
f(\om)&\text{ if }\om\in\tOm, \\ 
m&\text{ if }\om\in\Om\setminus\tOm.  
\end{cases}$$
The $g$ will have the desired properties.

The OP has changed the question, thus invalidating the answer above.
The answer to the changed question is still yes, but the construction is much more complicated.
Since the manifold $M$ is compact, it has a finite atlas $A:=\{(U_i,\vpi_i)\colon i\in[k]\}$, where $[k]:=\{i\in\N\colon i\le k\}$, with bounded images $\vpi_i(U_i)$ of the $U_i$'s. Without loss of generality (wlog), $A$ is a refinement of another atlas $\{(V_i,\psi_i)\colon i\in[k]\}$ of $M$ in the sense that $\ol{U_i}\subseteq V_i$ and $\vpi_i=\psi_i|_{U_i}$ for all $i$, where $\ol S$ denotes the closure of a set $S$ and $|_S$ denotes the restriction to $S$.
For each $i\in[k]$, let
\begin{equation}
    \hat\Om_i:=f^{-1}(U_i), \quad 
    \Om_i:=\ol{\hat\Om_i}\setminus\bigcup_{j\in[k-1]}\ol{\hat\Om_j}, \quad 
    \tOm_i:=\hat\Om_i\cap\Om_i.  
\end{equation}
Then
\begin{equation}
    \Om=\bigcup_{i\in[k]}\Om_i 
\end{equation}
(because $M=\bigcup_{i\in[k]}U_i$, whence $\tOm=\bigcup_{i\in[k]}\hat\Om_i$, whence  $\Om=\ol\tOm=\ol{\bigcup_{i\in[k]}\hat\Om_i}=\bigcup_{i\in[k]}\ol{\hat\Om_i}=\bigcup_{i\in[k]}\Om_i$);

*

*the $\Om_i$'s are pairwise disjoint and measurable;


*$\tOm_i$ is countable and dense in $\Om_i$ for each $i$ (because the $\ol{\hat\Om_i}$'s are closed sets);


*$f(\tOm_i)\subseteq U_i$ for each $i$.
So, it suffices to construct the function $g$ locally -- that is, separately on each $\Om_i$. So, to simplify notations in what follows, fix any $i\in[k]$ and let

*

*$U:=U_i$, $\vpi:=\vpi_i$, and $\psi:=\psi_i$.


*Also, re-define $\Om$ and $\tOm$ by letting them, respectively, denote $\Om_i$ and $\tOm_i$, from now on.
In other words, we are going to omit the subscript ${}_i$ everywhere in what follows.
Let $n$ denote the dimension of the manifold $M$, so that
\begin{equation}
    \vpi(m)=(\vpi^1(m),\dots,\vpi^n(m))\in\R^n
\end{equation}
for some real-valued functions $\vpi^1,\dots,\vpi^n$ and all $m\in U$.
For $j\in[n]$, let
\begin{equation}
    h_j:=\vpi^j\circ f,\quad\text{so that }h_j\colon\tOm\to\R. 
\end{equation}
Take any real $\ep>0$. For each $\om\in\Om$, let
\begin{equation}
    H_\ep(\om):=\vpi(f(\tOm\cap B_\om(\ep)))
    =\{h(\tom)\colon\tom\in\tOm\cap B_\om(\ep)\},
\end{equation}
where
\begin{equation}
    h(\tom):=\vpi(f(\tom))=(h_1(\tom),\dots,h_n(\tom))
\end{equation}
and
\begin{equation}
    B_\om(\ep):=\{\tau\in\Om\colon d(\tau,\om)<\ep\}. 
\end{equation}
Since the map $\vpi$ is continuous and $f(\tOm\cap B_\om(\ep))\subseteq\ol U\subseteq M$, the set $\ol{H_\ep(\om)}$ is a compact  subset of $\R^n$. So, there is a unique maximum, say
\begin{equation}
    \ol h_\ep(\om)=(\ol h_{1,\ep}(\om),\dots,\ol h_{n,\ep}(\om))\in\R^n, 
\end{equation}
of the set $\ol{H_\ep(\om)}$ with respect to the (total/linear) lexicographic order.
Note that for any real $c_1$
\begin{equation}
\begin{aligned}
    &\ol h_{1,\ep}(\om)\le c_1 \\  
    &\iff \\ 
    &\forall\tom\in\tOm\quad \tom\in B_\om(\ep)\implies h_1(\tom)\le c_1,
\end{aligned}
\end{equation}
which can be rewritten as
\begin{equation}
\begin{aligned}
    &\ol h_{1,\ep}(\om)\le c_1 \\  
    &\iff \\ 
    &\forall\tom\in\tOm\quad \om\in B_\tom(\ep)\implies h_1(\tom)\le c_1,
\end{aligned}
\end{equation}
Letting $\Q_{++}:=\Q\cap(0,\infty)$,
by induction on $n$ one can show that for $n\ge2$ and any real $c_1,\dots,c_n$
\begin{align*}
    &\ol h_{1,\ep}(\om)\le c_1\ \&\ \cdots\ \&\ \ol h_{n,\ep}(\om)\le c_n \\ 
    &\iff \\ 
&   \begin{aligned}
&   \ol h_{1,\ep}(\om)\le c_1\ \&\ \cdots\ \&\ \ol h_{n-1,\ep}(\om)\le c_{n-1} \\ 
&\&\ \forall\de_n\in\Q_{++}\ \exists \de_1,\dots,\de_{n-1}\in\Q_{++}\ 
    \forall\tom\in\tOm\quad  \\ 
    &\quad\  \om\in B_\tom(\ep) \\ 
    &\quad\  \implies 
    (h_1(\tom)\ge c_1-\de_1\ \&\ \cdots\ \&\  h_{n-1}(\tom)\ge c_{n-1}-\de_{n-1} \\ 
&\qquad\qquad   \implies
    h_n(\tom)\le c_n+\de_n). 
\end{aligned}
\end{align*}
Therefore and because the balls $B_\tom(\ep)$ are measurable whereas the sets $\Q_{++}$ and $\tOm$ are countable, we conclude that the $\R^n$-valued function $\ol h_\ep$ is measurable.
Moreover, since the set $H_\ep(\om)$ is nondecreasing in $\ep$, so is the maximum $\ol h_\ep(\om)$ of the set $\ol{H_\ep(\om)}$. So, there is a pointwise limit $\ol h$ of $\ol h_\ep$: for each $\om\in\Om$,
\begin{equation}
    \ol h(\om):=\lim_{\ep\downarrow0}\ol h_\ep(\om) 
\end{equation}
and, hence, by the continuity of the map $\psi^{-1}$,
\begin{equation}
    g(\om):=\psi^{-1}(\ol h(\om))=\lim_{\ep\downarrow0}\psi^{-1}(\ol h_\ep(\om)).  
\end{equation}
The function $\ol h$ is measurable, as the pointwise limit of the measurable functions $\ol h_\ep$. Also, the continuous map $\psi^{-1}$ is measurable. So, $g=\psi^{-1}\circ \ol h$ is measurable.
The maximum $\ol h_\ep(\om)$ of the set $\ol{H_\ep(\om)}$ is of course in $\ol{H_\ep(\om)}$ and hence $\ol h_\ep(\om)=\lim_{r\to\infty}h(\tom_{\ep,\om,r})$ -- for each real $\ep>0$, each $\om\in\Om$, and some sequence $(\tom_{\ep,\om,r})_{r\in\N}$ in $\tOm\cap B_\om(\ep)$.
Since $\psi^{-1}$ is continuous and $\psi^{-1}(h(\tom))=f(\tom)$ for all $\tom\in\tOm$, we have
\begin{equation}
    g(\om)=\lim_{\ep\downarrow0}\psi^{-1}(\lim_{r\to\infty}h(\tom_{\ep,\om,r}))
    =\lim_{\ep\downarrow0}\lim_{r\to\infty}\psi^{-1}(h(\tom_{\ep,\om,r}))
    =\lim_{\ep\downarrow0}\lim_{r\to\infty}f(\tom_{\ep,\om,r}).  
\end{equation}
So, for each $\om\in\Om$ there is a sequence $(r_t(\om))_{t\in\N}$ in $\N$ such that
\begin{equation}
    g(\om)
    =\lim_{t\to\infty}f(\tom_{1/t,\om,r_t(\om)}).  
\end{equation}
Moreover, $\tom_{1/t,\om,r_t(\om)}\in B_\om(1/t)$ and hence $\tom_{1/t,\om,r_t(\om)}\to\om$ as $t\to\infty$. $\quad\Box$
Remark: Some of the conditions here can be relaxed. In particular, we do not need $M$ to be a Riemannian manifold or any manifold at all. In particular, it suffices that $M$ be any topological space admitting a finite open cover $\{U_i\colon i\in[k]\}$ with homeomorphisms $\psi_i$ of $\ol{U_i}$ onto compact domains $D_i\subset\R^{n_i}$, for each $i\in[k]$.
