For a non-negative integer $k$, a $k$-independent set in a graph $G$ is a vertex set ${S\subseteq V(G)}$ such that the distance between any two vertices in $S$ is bigger than $k$. The $k$@-independence number of a graph $G$ is the maximum size of a $k$-independent set in $G$ and is denoted by $\alpha_k(G)$. For every $k\geq2$, determining $\alpha_k(G)$ is NP-complete for general graphs, and this problem remains NP-hard for regular bipartite graphs when ${k\in\{2,3,4\}}$. \par In this paper, the authors prove sharp upper bounds for $\alpha_k(G)$ in an $n$-vertex connected graph with ${\rm diam}(G)\geq k+1$ for each positive integer $k$ with given minimum and maximum degree. The main results appear in the following theorem: \par Theorem 1. For positive integers $k$ and $\ell$, let $\delta$ and $\Delta$ be the minimum and maximum degree of $G$, respectively. If $G$ is an $n$-vertex connected graph with ${\rm diam}(G)\geq k+1$, then we have the following: \roster \item If $k=1$, then $\alpha_k(G)\leq\frac{\Delta n}{\Delta+\delta}$. \item If $k\geq 2$ and $\delta\leq 2$, then $$ \alpha_k(G)\leq \cases \frac{\Delta n}{\Delta\left(\delta+\frac{k-1}{2}\right)+1}&\text{if}\ k\ \text{is odd},\\ \frac{n}{\delta+\frac{k}{2}}&\text{if}\ k\ \text{is even}. \endcases $$ \item If $k=6\ell-4$ and $\delta\geq 3$, then $\alpha_k(G)\leq \frac{n}{\ell(\delta+1)}$. \item If $k=6\ell-3$ and $\delta\geq 3$, then $$ \alpha_k(G)\leq \cases \frac{\Delta n}{\ell\Delta+\ell\delta\Delta+1}&\text{if}\ \Delta>\delta,\\ \frac{\Delta n}{\ell\Delta+\ell\delta\Delta+2}&\text{if}\ \Delta=\delta. \endcases $$ \item If $k=6\ell-2$ and $\delta\geq 3$, then $\alpha_k(G)\leq \frac{n}{\ell(\delta+1)+1}$. \item If $k=6\ell-1$ and $\delta\geq 3$, then $$ \alpha_k(G)\leq \cases \frac{\Delta n}{\ell\Delta(\delta+1)+\Delta+2}&\text{if}\ \Delta=\delta\ \text{is even},\\ \frac{\Delta n}{\ell\Delta(\delta+1)+\Delta+1}&\text{otherwise}. \endcases $$ \item If $k=6\ell$ and $\delta\geq 3$, then $$ \alpha_k(G)\leq \cases \frac{\Delta n}{\ell(\delta+1)+3}&\text{if}\ \Delta=\delta\ \text{is even},\\ \frac{\Delta n}{\ell(r\delta+1)+2}&\text{otherwise}. \endcases $$ \item If $k=6\ell+1$ and $\delta\geq 3$, then $$ \alpha_k(G)\leq \cases \frac{\Delta n}{\ell\Delta(\delta+1)+2\Delta+\delta-1}&\text{if}\ \delta \ \text{is odd},\\ \frac{\Delta n}{\ell\Delta(\delta+1)+3\Delta+\delta-2}&\text{if}\ \delta \ \text{is even}. \endcases $$ \endroster For $i\in\{1,\dots,11\}$, $k\geq 2$ and $\delta\geq 3$, equalities hold for the graph $G^i_{r,k,t}$, the disjoint union of $t$ copies of $H^i_{r,k}$.