Well here goes these are the steps that worked for me. Hope this helps but I have to say that you follow them at your own risk.
I am certainly Linux no expert and I am using a RPi4 running the latest version of RPi OS.
All the commands following are typed in a terminal window after the $ prompt. I have shown them in large font

I am not sure if git is installed as standard but make sure you have it by typing

Sudo apt update
Sudo apt install git

To verify enter the command
git --version

Since RPi OS is a version of Debian I followed the steps on the link below for Debian.
If you copy and paste this into your browser it will give more info.

The first thing is to make sure you have all the prerequisites and dependencies.
So open Terminal and type the following command, probably easiest to copy and paste it using the right mouse button. This is all one line it is just wrapping in the viewer.

sudo apt-get -y install build-essential cmake git libeigen3-dev libcfitsio-dev zlib1g-dev libindi-dev extra-cmake-modules libkf5plotting-dev libqt5svg5-dev libkf5xmlgui-dev kio-dev kinit-dev libkf5newstuff-dev kdoctools-dev libkf5notifications-dev qtdeclarative5-dev libkf5crash-dev gettext libnova-dev libgsl-dev libraw-dev libkf5notifyconfig-dev wcslib-dev libqt5websockets5-dev xplanet xplanet-images qt5keychain-dev libsecret-1-dev breeze-icon-theme

You will be asked for your password which in my case was the default

It might ask you to confirm some things as it runs just type Y if prompted.

When it's done you will be returned to the Terminal prompt $

Create and change into a KDE development directory:
mkdir ~/kde && cd ~/kde

Fetch the KStars source code: this site converts links to green characters so make sure that you copy and paste the following line:
git clone anongit.kde.org/kstars

Create and change into a build directory for compilation:
mkdir build && cd build

The next steps will take some time so get a coffee

Run the configure process with cmake:
cmake ../kstars -DCMAKE_INSTALL_PREFIX=/usr

Compile KStars:

Install KStars:

sudo make install

Thats it.

To get updates in future its very easy
cd ~/kde/kstars
Git pull —rebase

Good luck