Upvote:4
Since you are Mileage plus, the safest bet would be to book on United using UA flight numbers (regardless of who owns the metal).
Since United has switched to miles+dollars for status miles, it's become more complicated and prone to errors to get Star Alliance miles credited. I had a Lufthansa flight that came through with $0 and I had to call twice to get it fixed.
In most cases you will get the same miles (Status + Reward), but it's not guaranteed. I had a Shanghai to FRA flight on LH where the return didn't score any miles at all because it was the wrong fare class (E class if I recall correctly). That was a lot of miles down the drain. So if you are planning to book on Lufthansa, I would carefully read the fine print.
Upvote:5
Frequent flyer points are awarded based on the marketing carrier's policy. So if you are flying on LH metal, but your booking is with a UA number, then United's rules apply.
If you are flying on LH metal, with a LH flight number on your booking, then points depend on Luftansa's agreements with United. These days, whatever the airline award's its own frequent flyers with is usually what gets awarded to an alliance airline's members.
For your particular flight choices you would need to look up Luftansa's arrangements for how much you get awarded for the second leg. But I think you get the same.