One way to do this is to divide the data into two portions based on gender and then utilize
ROW_NUMBER (Transact-SQL) - SQL Server | Microsoft Docs[
^] function.
Consider the following example
with data as (
select 1 as Id, 'M' as Name, 'M' AS Gender
union select 2 as Id, 'N' as Name, 'F' AS Gender
union select 3 as Id, 'B' as Name, 'M' AS Gender
union select 4 as Id, 'V' as Name, 'M' AS Gender
union select 5 as Id, 'C' as Name, 'F' AS Gender
)
select id, name, gender, ROW_NUMBER() over (order by id)
from data
where gender = 'M'
union
select id, name, gender, ROW_NUMBER() over (order by id) + 0.5
from data
where gender = 'F'
order by 4;