These are the steps:

[email protected]:/tmp$ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
--2022-12-19 19:32:45--  https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
Resolving packages.microsoft.com (packages.microsoft.com)... 13.90.21.104
Connecting to packages.microsoft.com (packages.microsoft.com)|13.90.21.104|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3690 (3,6K) [application/octet-stream]
Saving to: ‘packages-microsoft-prod.deb’

packages-microsoft-prod 100%[==============================>]   3,60K  --.-KB/s    in 0s      

2022-12-19 19:32:51 (1,14 GB/s) - ‘packages-microsoft-prod.deb’ saved [3690/3690]

[email protected]:/tmp$ sudo dpkg -i packages-microsoft-prod.deb
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 514992 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu20.04.1) ...
Setting up packages-microsoft-prod (1.0-ubuntu20.04.1) ...
[email protected]:/tmp$ sudo apt update
Hit:1 http://br.archive.ubuntu.com/ubuntu focal InRelease
Get:2 http://br.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                    
Get:3 http://br.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]                  
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease                                 
Get:5 http://br.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [274 kB]   
Get:6 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                     
Get:7 http://br.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [407 kB]
Get:8 http://br.archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:9 http://br.archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [7.960 B]
Get:10 http://br.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30,5 kB]
Hit:11 http://ppa.launchpad.net/obsproject/obs-studio/ubuntu focal InRelease                  
Hit:12 http://dell.archive.canonical.com focal InRelease                                      
Hit:13 http://packages.microsoft.com/repos/code stable InRelease                              
Hit:14 http://ppa.launchpad.net/umang/indicator-stickynotes/ubuntu focal InRelease            
Get:15 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40,7 kB]  
Get:16 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease [10,5 kB]             
Get:17 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [93,9 kB]
Hit:18 https://packages.microsoft.com/repos/ms-teams stable InRelease                  
Get:19 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B]
Hit:20 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu focal InRelease   
Get:21 https://packages.microsoft.com/ubuntu/20.04/prod focal/main armhf Packages [30,0 kB]
Get:22 https://packages.microsoft.com/ubuntu/20.04/prod focal/main arm64 Packages [47,3 kB]
Get:23 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 Packages [221 kB]
Get:24 https://packages.microsoft.com/ubuntu/20.04/prod focal/main arm64 Contents (deb) [274 kB]
Get:25 https://packages.microsoft.com/ubuntu/20.04/prod focal/main armhf Contents (deb) [265 kB]
Get:26 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 Contents (deb) [2.805 kB]
Fetched 4.846 kB in 3s (1.548 kB/s)                                      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
53 packages can be upgraded. Run 'apt list --upgradable' to see them.
[email protected]:/tmp$ sudo apt install apt-transport-https
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  arduino-core avr-libc binutils-avr binutils-riscv64-unknown-elf gcc-avr libjna-java
  libjna-jni librxtx-java libwireshark13 libwiretap10 libwsutil11 libxmlb1 mpv
  python3-pyxattr rtmpdump
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 53 not upgraded.
Need to get 1.704 B of archives.
After this operation, 162 kB of additional disk space will be used.
Get:1 http://br.archive.ubuntu.com/ubuntu focal-updates/universe amd64 apt-transport-https all 2.0.9 [1.704 B]
Fetched 1.704 B in 0s (15,6 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 515000 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_2.0.9_all.deb ...
Unpacking apt-transport-https (2.0.9) ...
Setting up apt-transport-https (2.0.9) ...
[email protected]:/tmp$ sudo apt install dotnet-sdk-3.1 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  arduino-core avr-libc binutils-avr binutils-riscv64-unknown-elf gcc-avr libjna-java
  libjna-jni librxtx-java libwireshark13 libwiretap10 libwsutil11 libxmlb1 mpv
  python3-pyxattr rtmpdump
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  aspnetcore-runtime-3.1 aspnetcore-targeting-pack-3.1 dotnet-apphost-pack-3.1 dotnet-host
  dotnet-hostfxr-3.1 dotnet-runtime-3.1 dotnet-runtime-deps-3.1 dotnet-targeting-pack-3.1
  netstandard-targeting-pack-2.1
The following NEW packages will be installed:
  aspnetcore-runtime-3.1 aspnetcore-targeting-pack-3.1 dotnet-apphost-pack-3.1 dotnet-host
  dotnet-hostfxr-3.1 dotnet-runtime-3.1 dotnet-runtime-deps-3.1 dotnet-sdk-3.1
  dotnet-targeting-pack-3.1 netstandard-targeting-pack-2.1
0 upgraded, 10 newly installed, 0 to remove and 53 not upgraded.
Need to get 82,2 MB of archives.
After this operation, 346 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-host amd64 7.0.1-1 [57,3 kB]
Get:2 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-hostfxr-3.1 amd64 3.1.32-1 [121 kB]
Get:3 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-runtime-deps-3.1 amd64 3.1.32-1 [2.674 B]
Get:4 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-runtime-3.1 amd64 3.1.32-1 [21,9 MB]
Get:5 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 aspnetcore-runtime-3.1 amd64 3.1.32-1 [5.773 kB]
Get:6 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-targeting-pack-3.1 amd64 3.1.0-1 [1.988 kB]
Get:7 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 aspnetcore-targeting-pack-3.1 amd64 3.1.10-1 [1.063 kB]
Get:8 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-apphost-pack-3.1 amd64 3.1.32-1 [42,3 kB]
Get:9 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 netstandard-targeting-pack-2.1 amd64 2.1.0-1 [1.476 kB]
Get:10 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 dotnet-sdk-3.1 amd64 3.1.426-1 [49,8 MB]
Fetched 82,2 MB in 17s (4.789 kB/s)                                                           
Selecting previously unselected package dotnet-host.
(Reading database ... 515004 files and directories currently installed.)
Preparing to unpack .../0-dotnet-host_7.0.1-1_amd64.deb ...
Unpacking dotnet-host (7.0.1-1) ...
Selecting previously unselected package dotnet-hostfxr-3.1.
Preparing to unpack .../1-dotnet-hostfxr-3.1_3.1.32-1_amd64.deb ...
Unpacking dotnet-hostfxr-3.1 (3.1.32-1) ...
Selecting previously unselected package dotnet-runtime-deps-3.1.
Preparing to unpack .../2-dotnet-runtime-deps-3.1_3.1.32-1_amd64.deb ...
Unpacking dotnet-runtime-deps-3.1 (3.1.32-1) ...
Selecting previously unselected package dotnet-runtime-3.1.
Preparing to unpack .../3-dotnet-runtime-3.1_3.1.32-1_amd64.deb ...
Unpacking dotnet-runtime-3.1 (3.1.32-1) ...
Selecting previously unselected package aspnetcore-runtime-3.1.
Preparing to unpack .../4-aspnetcore-runtime-3.1_3.1.32-1_amd64.deb ...
Unpacking aspnetcore-runtime-3.1 (3.1.32-1) ...
Selecting previously unselected package dotnet-targeting-pack-3.1.
Preparing to unpack .../5-dotnet-targeting-pack-3.1_3.1.0-1_amd64.deb ...
Unpacking dotnet-targeting-pack-3.1 (3.1.0-1) ...
Selecting previously unselected package aspnetcore-targeting-pack-3.1.
Preparing to unpack .../6-aspnetcore-targeting-pack-3.1_3.1.10-1_amd64.deb ...
Unpacking aspnetcore-targeting-pack-3.1 (3.1.10-1) ...
Selecting previously unselected package dotnet-apphost-pack-3.1.
Preparing to unpack .../7-dotnet-apphost-pack-3.1_3.1.32-1_amd64.deb ...
Unpacking dotnet-apphost-pack-3.1 (3.1.32-1) ...
Selecting previously unselected package netstandard-targeting-pack-2.1.
Preparing to unpack .../8-netstandard-targeting-pack-2.1_2.1.0-1_amd64.deb ...
Unpacking netstandard-targeting-pack-2.1 (2.1.0-1) ...
Selecting previously unselected package dotnet-sdk-3.1.
Preparing to unpack .../9-dotnet-sdk-3.1_3.1.426-1_amd64.deb ...
Unpacking dotnet-sdk-3.1 (3.1.426-1) ...
Setting up dotnet-host (7.0.1-1) ...
Setting up dotnet-apphost-pack-3.1 (3.1.32-1) ...
Setting up netstandard-targeting-pack-2.1 (2.1.0-1) ...
Setting up dotnet-targeting-pack-3.1 (3.1.0-1) ...
Setting up aspnetcore-targeting-pack-3.1 (3.1.10-1) ...
Setting up dotnet-runtime-deps-3.1 (3.1.32-1) ...
Setting up dotnet-hostfxr-3.1 (3.1.32-1) ...
Setting up dotnet-runtime-3.1 (3.1.32-1) ...
Setting up aspnetcore-runtime-3.1 (3.1.32-1) ...
Setting up dotnet-sdk-3.1 (3.1.426-1) ...
This software may collect information about you and your use of the software, and send that to 
Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. It is colle
cted by Microsoft and shared with the community. You can opt-out of telemetry by setting the DO
TNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

Configuring...
--------------
A command is running to populate your local package cache to improve restore speed and enable o
ffline access. This command takes up to one minute to complete and only runs once.
Processing triggers for man-db (2.9.1-1) ...
[email protected]:/tmp$ dotnet --version
3.1.426

Source: https://tecadmin.net/how-to-install-net-core-on-ubuntu-20-04/