The child will be of the dominant partners dynasty. If they are patrilineally married (normal marriage), the child will be of the fathers dynasty. If they are matrilineally married, children will be of the mothers dynasty. Whether or not anyone are bastards are irrelevant to the equation at this point – provided that the bastard is legitimized.
If the bastard is not legitimized, and he is the dominant partner, his children will actually create a new house.
It sounds like you want to marry them matrilineally, but the male part is not always willing to accept this, unless for example the female is of significantly higher status. When you make a proposal, you can hover over their "answer" to see why they won't agree to it. If it's because they don't like you, a gift might sweeten the deal.
Otherwise, you might be able to invite them to your court, in which case they will agree to your arrangement no matter what.